Skip to content

Commit dfb786d

Browse files
authored
Use same colour despite different cases; fixes #42 (#44)
- When system themes use lower case colour names and icon theme uses the captialized word, different colour are variants were getting set. Now same variant will be set despite the difference in cases in colour names.
1 parent 42b6e5a commit dfb786d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: src/ThemeManager/common.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def prep_theme_variants(self, state, theme_styles):
233233
stateflag = 1
234234
module_logger.info("Current State: %s", currentstate)
235235

236-
if self.icon_theme:
236+
if self.icon_theme:
237237
icontheme = self.prep_icon_theme(currentstate, currentcolor)
238238

239239
if self.cursor_theme:
@@ -292,8 +292,10 @@ def prep_theme_variants(self, state, theme_styles):
292292
return nxt_theme
293293

294294
def prep_icon_theme(self, currentstate, currentcolor):
295-
if currentcolor in self.icon_colvariants:
296-
iconcolor = currentcolor
295+
for color in self.icon_colvariants:
296+
if currentcolor.lower() in color.lower():
297+
iconcolor = color
298+
break
297299
else:
298300
iconcolor = random.choice(self.icon_colvariants)
299301
module_logger.debug("Icon Colour Variant: %s", iconcolor)
@@ -312,11 +314,14 @@ def prep_icon_theme(self, currentstate, currentcolor):
312314
else:
313315
icontheme = self.iconthemename
314316

317+
module_logger.debug("Icon Theme: %s, Colour Variant: %s" % (icontheme, iconcolor))
315318
return icontheme
316319

317320
def prep_cursor_theme(self, currentcolor):
318-
if currentcolor in self.cursor_colvariants:
319-
cursrcolor = currentcolor
321+
for color in self.cursor_colvariants:
322+
if currentcolor.lower() in color.lower():
323+
cursrcolor = color
324+
break
320325
else:
321326
cursrcolor = random.choice(self.cursor_colvariants)
322327
module_logger.debug("Cursor Colour Variant: %s", cursrcolor)

0 commit comments

Comments
 (0)