From d9a5ac43951bde210c2bab763ac5cb4b2317d891 Mon Sep 17 00:00:00 2001 From: Amit Chaudhary Date: Sat, 12 Oct 2024 20:10:29 +0530 Subject: [PATCH] add new backgrounds for weather conditions during day --- src/css/style.css | 83 +++++++++++++++++++++++++++++++++++++---------- src/mousam.py | 15 +++++---- 2 files changed, 74 insertions(+), 24 deletions(-) diff --git a/src/css/style.css b/src/css/style.css index 24c3188..757f1d1 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -269,47 +269,96 @@ /* Replace with your desired color */ } -.clear_sky, +.clear_sky { + background-color: hsla(205, 60%, 35%, 1); + background-image: + radial-gradient(at 100% 5%, hsla(215, 43%, 77%, 0.51) 0px, transparent 50%), + radial-gradient(at 43% 38%, hsla(206, 47%, 45%, 0.87) 0px, transparent 50%), + radial-gradient(at 0% 0%, hsla(24, 1%, 83%, 0.69) 0px, transparent 50%), + radial-gradient(at 43% 99%, hsla(214, 71%, 36%, 0.88) 0px, transparent 50%); +} + .few_clouds { - background: linear-gradient(127deg, rgba(187, 188, 179, 1), rgba(0, 134, 218, 0) 100%), - linear-gradient(217deg, rgba(187, 188, 179, 1), rgba(0, 174, 258, 1) 100%), - linear-gradient(136deg, rgba(187, 188, 179, 1), rgba(0, 174, 258, 1) 100%); + /* background: linear-gradient(127deg, rgba(187, 188, 179, 1), rgba(0, 134, 218, 0) 100%), + linear-gradient(217deg, rgba(187, 188, 179, 1), rgba(0, 174, 258, 1) 100%), + linear-gradient(136deg, rgba(187, 188, 179, 1), rgba(0, 174, 258, 1) 100%); */ + background-color: hsla(210, 51%, 40%, 1); + background-image: + radial-gradient(at 46% 22%, hsla(201, 54%, 45%, 1) 0px, transparent 50%), + radial-gradient(at 0% 0%, hsla(180, 17%, 72%, 1) 0px, transparent 50%), + radial-gradient(at 28% 88%, hsla(0, 0%, 74%, 0.59) 0px, transparent 50%), + radial-gradient(at 86% 78%, hsla(200, 19%, 59%, 1) 0px, transparent 50%); +} + +.overcast { + background-color: hsla(210, 48%, 33%, 1); + background-image: + radial-gradient(at 72% 40%, hsla(216, 16%, 24%, 0.41) 0px, transparent 50%), + radial-gradient(at 49% 30%, hsla(201, 51%, 43%, 1) 0px, transparent 50%), + radial-gradient(at 0% 0%, hsla(195, 45%, 70%, 1) 0px, transparent 50%), + radial-gradient(at 86% 78%, hsla(195, 14%, 46%, 1) 0px, transparent 50%); } -.overcast, .showers_scattered { - background: linear-gradient(127deg, rgba(155, 155, 155, 1), rgba(0, 134, 215, 0) 100%), - linear-gradient(217deg, rgba(155, 155, 155, 1), rgba(0, 134, 215, 1) 100%), - linear-gradient(336deg, rgba(155, 155, 155, 1), rgba(0, 134, 218, 1) 100%); + background-color: hsla(206, 25%, 51%, 1); + background-image: + radial-gradient(at 85% 68%, hsla(206, 40%, 35%, 0.96) 0px, transparent 50%), + radial-gradient(at 0% 0%, hsla(265, 7%, 57%, 0.69) 0px, transparent 50%), + radial-gradient(at 56% 89%, hsla(206, 61%, 22%, 1) 0px, transparent 50%), + radial-gradient(at 75% 27%, hsla(215, 43%, 77%, 0.47) 0px, transparent 50%), + radial-gradient(at 92% 12%, hsla(0, 0%, 0%, 0.87) 0px, transparent 50%), + radial-gradient(at 3% 66%, hsla(206, 52%, 27%, 1) 0px, transparent 50%); } .showers_large { - background: linear-gradient(127deg, rgba(134, 137, 154, 1), rgba(134, 137, 154, 0) 100%), + /* background: linear-gradient(127deg, rgba(134, 137, 154, 1), rgba(134, 137, 154, 0) 100%), linear-gradient(217deg, rgba(134, 137, 154, 1), rgba(0, 134, 218, 1) 100%), - linear-gradient(336deg, rgba(134, 137, 154, 1), rgba(0, 134, 218, 1) 100%); + linear-gradient(336deg, rgba(134, 137, 154, 1), rgba(0, 134, 218, 1) 100%); */ + background-color: hsla(205, 26%, 38%, 1); + background-image: + radial-gradient(at 3% 0%, hsla(240, 18%, 15%, 0.69) 0px, transparent 50%), + radial-gradient(at 85% 68%, hsla(210, 34%, 20%, 0.96) 0px, transparent 50%), + radial-gradient(at 89% 11%, hsla(213, 14%, 4%, 0.56) 0px, transparent 50%), + radial-gradient(at 66% 100%, hsla(206, 42%, 14%, 1) 0px, transparent 50%), + radial-gradient(at 19% 73%, hsla(214, 33%, 25%, 1) 0px, transparent 50%), + radial-gradient(at 58% 0%, hsla(209, 95%, 82%, 0.75) 0px, transparent 50%), + radial-gradient(at 55% 24%, hsla(195, 0%, 0%, 0.94) 0px, transparent 50%); } .storm { - background: linear-gradient(127deg, rgb(108, 123, 152), rgb(92, 92, 92)), + /* background: linear-gradient(127deg, rgb(108, 123, 152), rgb(92, 92, 92)), linear-gradient(217deg, rgb(108, 123, 152), rgb(92, 92, 92)), - linear-gradient(336deg, rgb(108, 123, 152), rgb(92, 92, 92)); + linear-gradient(336deg, rgb(108, 123, 152), rgb(92, 92, 92)); */ + background-color: hsla(211, 21%, 35%, 1); + background-image: + radial-gradient(at 43% 37%, hsla(205, 22%, 9%, 0.76) 0px, transparent 50%), + radial-gradient(at 38% 77%, hsla(203, 32%, 12%, 0.73) 0px, transparent 50%), + radial-gradient(at 98% 88%, hsla(217, 15%, 9%, 0.9) 0px, transparent 50%), + radial-gradient(at 67% 94%, hsla(217, 20%, 14%, 1) 0px, transparent 50%), + radial-gradient(at 6% 89%, hsla(17, 3%, 53%, 1) 0px, transparent 50%), + radial-gradient(at 99% 10%, hsla(189, 14%, 12%, 0.92) 0px, transparent 50%), + radial-gradient(at 17% 4%, hsla(212, 19%, 14%, 1) 0px, transparent 50%), + radial-gradient(at 66% 0%, hsla(213, 100%, 81%, 0.72) 0px, transparent 50%); } .snow { - background: linear-gradient(135deg, rgb(40, 60, 87) 0%, rgb(80, 104, 133) 30%, rgb(137, 166, 181) 60%, rgb(187, 195, 202) 80%, rgb(187, 195, 202) 100%), - linear-gradient(45deg, rgb(200, 203, 207), rgb(212, 213, 215) 50%, rgba(255, 255, 255, 0.9)); + /* background: linear-gradient(135deg, rgb(40, 60, 87) 0%, rgb(80, 104, 133) 30%, rgb(137, 166, 181) 60%, rgb(187, 195, 202) 80%, rgb(187, 195, 202) 100%), + linear-gradient(45deg, rgb(200, 203, 207), rgb(212, 213, 215) 50%, rgba(255, 255, 255, 0.9)); */ + background: rgb(32, 79, 156); + background: linear-gradient(171deg, rgba(32, 79, 156, 1) 11%, rgba(44, 91, 145, 1) 33%, rgba(105, 133, 154, 1) 63%, rgba(213, 215, 217, 1) 97%); } .fog { - background: linear-gradient(49deg, transparent 0%, rgba(212, 195, 156, 0.43) 100%) 68% 73%/194% 147%, - linear-gradient(137deg, #9cafb0 0%, #c4c3be 70%, #c5c8b5 100%) 72% 55%/174% 123%; - + /* background: linear-gradient(49deg, transparent 0%, rgba(212, 195, 156, 0.43) 100%) 68% 73%/194% 147%, + linear-gradient(137deg, #9cafb0 0%, #c4c3be 70%, #c5c8b5 100%) 72% 55%/174% 123%; */ + background: rgb(53, 60, 59); + background: linear-gradient(0deg, rgba(53, 60, 59, 1) 3%, rgba(86, 92, 93, 1) 40%, rgba(138, 142, 153, 1) 73%, rgba(197, 202, 210, 1) 100%); } /* ------------- night --------------- */ diff --git a/src/mousam.py b/src/mousam.py index 07b0506..a5e0b53 100644 --- a/src/mousam.py +++ b/src/mousam.py @@ -37,7 +37,7 @@ class WeatherMainWindow(Gtk.ApplicationWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - + self.main_window = self self.set_default_size(settings.window_width, settings.window_height) self.connect("close-request", self.save_window_state) @@ -179,7 +179,9 @@ def show_welcome_screen(self): welcome_label.set_css_classes(["text-2a", "bold-2"]) container_welcome.append(welcome_label) - btn_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,halign=Gtk.Align.CENTER) + btn_box = Gtk.Box( + orientation=Gtk.Orientation.HORIZONTAL, halign=Gtk.Align.CENTER + ) btn_box.set_margin_top(15) add_loc_button = Gtk.Button(label="Add Location") add_loc_button.connect("clicked", self._on_locations_clicked) @@ -187,7 +189,6 @@ def show_welcome_screen(self): btn_box.append(add_loc_button) container_welcome.append(btn_box) - self.main_stack.add_named(container_welcome, "welcome") self.main_stack.set_visible_child_name("welcome") @@ -235,7 +236,7 @@ def _load_weather_data(self): if not has_internet: self.show_error() return - + if len(self.added_cities) == 0: self.show_welcome_screen() return @@ -402,10 +403,10 @@ def _use_dynamic_bg(self, weather_code: int = 0, is_day: int = 1): for cl in self.get_css_classes(): if cl not in dont_delete_classes: self.remove_css_class(cl) - weather_code = str(weather_code) + weather_code_str = str(weather_code) if is_day == 0: - weather_code += "n" - self.add_css_class(css_class=bg_css[weather_code]) + weather_code_str += "n" + self.add_css_class(css_class=bg_css[weather_code_str]) # ============= Menu button methods ============== def _on_about_clicked(self, *args, **kwargs):