+15
-9
lines changedFilter options
+15
-9
lines changed Original file line number Diff line number Diff line change
@@ -21,12 +21,16 @@ def color_hex_from_list(color_list):
21
21
return ''.join([int_to_hex(i) for i in color_list])
22
22
23
23
24
-
def is_dark(color_text):
24
+
def hex_lightness(color_text):
25
25
# @TODO: use real lightness from HSV or Lab color model
26
26
return sum([
27
27
hex_to_int(channel_text)
28
28
for channel_text in color_list_from_hex(color_text)
29
-
]) < 384
29
+
]) / 765
30
+
31
+
32
+
def is_dark(color_text):
33
+
return hex_lightness(color_text) < 0.5
30
34
31
35
32
36
def hex_darker(color_text, darken_amount=10):
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
from .theme_model import THEME_MODEL
6
6
from .color import (
7
-
convert_theme_color_to_gdk, mix_theme_colors, mix_gdk_colors,
7
+
convert_theme_color_to_gdk, mix_theme_colors, mix_gdk_colors, hex_lightness,
8
8
)
9
9
from .gtk_helpers import ScaledImage
10
10
from .preview_terminal import TerminalThemePreview
@@ -344,11 +344,13 @@ def update_preview_borders(self, colorscheme):
344
344
), (
345
345
'entry',
346
346
self.gtk_preview.entry,
347
-
mix_theme_colors(
348
-
colorscheme['TXT_FG'], colorscheme['TXT_BG'], 0.20
349
-
),
350
-
colorscheme['BG'],
351
-
0.69
347
+
colorscheme['TXT_BG'],
348
+
colorscheme['TXT_FG'],
349
+
0.8 * (0.7 + (
350
+
0 if hex_lightness(colorscheme['TXT_BG']) > 0.66 else (
351
+
0.1 if hex_lightness(colorscheme['TXT_BG']) > 0.33 else 0.3
352
+
)
353
+
))
352
354
),
353
355
):
354
356
border_color = mix_theme_colors(fg, bg, ratio)
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4