Files
Cloud-CMS/modules/forecastio-css-generator.twig
Matt Batchelder 05ce0da296 Initial Upload
2025-12-02 10:32:59 -05:00

133 lines
4.1 KiB
Twig

{#
/**
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
#}
{% macro backgrounds(backgroundImage, cloudyImage, dayCloudyImage, dayClearImage, fogImage, hailImage, nightClearImage, nightPartlyCloudyImage, rainImage, snowImage, windyImage) %}
{% if backgroundImage != 'none' %}
.bg-cloudy {
background-image: url("{% if cloudyImage != "" %}{{ cloudyImage }}{% else %}[[assetId=wi-cloudy]]{% endif %}");
}
.bg-partly-cloudy-day {
background-image: url("{% if dayCloudyImage != "" %}{{ dayCloudyImage }}{% else %}[[assetId=wi-day-cloudy]]{% endif %}");
}
.bg-clear-day {
background-image: url("{% if dayClearImage %}{{ dayClearImage }}{% else %}[[assetId=wi-day-sunny]]{% endif %}");
}
.bg-fog {
background-image: url("{% if fogImage %}{{ fogImage }}{% else %}[[assetId=wi-fog]]{% endif %}");
}
.bg-sleet {
background-image: url("{% if hailImage %}{{ hailImage }}{% else %}[[assetId=wi-hail]]{% endif %}");
}
.bg-clear-night {
background-image: url("{% if nightClearImage %}{{ nightClearImage }}{% else %}[[assetId=wi-night-clear]]{% endif %}");
}
.bg-partly-cloudy-night {
background-image: url("{% if nightPartlyCloudyImage %}{{ nightPartlyCloudyImage }}{% else %}[[assetId=wi-night-partly-cloudy]]{% endif %}");
}
.bg-rain {
background-image: url("{% if rainImage %}{{ rainImage }}{% else %}[[assetId=wi-rain]]{% endif %}");
}
.bg-snow {
background-image: url("{% if snowImage %}{{ snowImage }}{% else %}[[assetId=wi-snow]]{% endif %}");
}
.bg-wind {
background-image: url("{% if windyImage %}{{ windyImage }}{% else %}[[assetId=wi-windy]]{% endif %}");
}
.bg-cloudy, .bg-partly-cloudy-day, .bg-clear-day, .bg-fog, .bg-sleet, .bg-clear-night, .bg-partly-cloudy-night, .bg-rain, .bg-snow, .bg-wind {
background-position: center;
{% if backgroundImage == 'center' %}
background-size: contain;
{% elseif backgroundImage == 'stretch' %}
background-size: 100% 100%;
{% else %}
background-size: cover;
{% endif %}
background-repeat: no-repeat;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: -1;
}
{% else %}
.bg-cloudy, .bg-partly-cloudy-day, .bg-clear-day, .bg-fog, .bg-sleet, .bg-clear-night, .bg-partly-cloudy-night, .bg-rain, .bg-snow, .bg-wind {
background-image: none;
}
{% endif %}
{% endmacro %}
{% macro colors(backgroundColor, textColor, iconsColor, footerColor, footerTextColor, footerIconsColor, shadowColor) %}
{% if backgroundColor != '' %}
#content > div {
background-color: {{ backgroundColor }} !important;
}
{% endif %}
{% if textColor != '' %}
#content > div {
color: {{ textColor }} !important;
}
{% endif %}
{% if iconsColor != '' %}
.wi {
color: {{ iconsColor }} !important;
}
{% endif %}
{% if footerColor != '' %}
.bg-footer {
background-color: {{ footerColor }} !important;
}
{% endif %}
{% if footerTextColor != '' %}
.bg-footer {
color: {{ footerTextColor }} !important;
}
{% endif %}
{% if footerIconsColor != '' %}
.bg-footer .wi {
color: {{ footerIconsColor }} !important;
}
{% endif %}
{% if shadowColor != '' %}
.shadowed {
text-shadow: 0 0 2px {{ shadowColor }};
filter: dropshadow(color={{ shadowColor }}, offx=2, offy=2);
}
{% endif %}
{% endmacro %}