Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit eb42008

Browse files
authored
Merge pull request #497 from patzm/patzm/feat/alpha_decimal
alpha decimal support
2 parents a2ddff3 + 0b31584 commit eb42008

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

pywal/templates/colors-kitty.conf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
foreground {foreground}
2-
background {background}
3-
cursor {cursor}
1+
foreground {foreground}
2+
background {background}
3+
background_opacity {background.alpha_dec}
4+
cursor {cursor}
45

56
active_tab_foreground {background}
67
active_tab_background {foreground}
78
inactive_tab_foreground {foreground}
89
inactive_tab_background {background}
910

10-
active_border_color {foreground}
11-
inactive_border_color {background}
12-
bell_border_color {color1}
11+
active_border_color {foreground}
12+
inactive_border_color {background}
13+
bell_border_color {color1}
1314

1415
color0 {color0}
1516
color8 {color8}

pywal/util.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,21 @@ def xrgba(self):
3636
def rgba(self):
3737
"""Convert a hex color to rgba."""
3838
return "rgba(%s,%s,%s,%s)" % (*hex_to_rgb(self.hex_color),
39-
int(self.alpha_num) / 100)
39+
self.alpha_dec)
4040

4141
@property
4242
def alpha(self):
4343
"""Add URxvt alpha value to color."""
4444
return "[%s]%s" % (self.alpha_num, self.hex_color)
4545

46+
@property
47+
def alpha_dec(self):
48+
"""Export the alpha value as a decimal number in [0, 1]."""
49+
return int(self.alpha_num) / 100
50+
4651
@property
4752
def octal(self):
48-
"""Export color in octal"""
53+
"""Export color in octal."""
4954
return "%s%s" % ("#", oct(int(self.hex_color[1:], 16))[2:])
5055

5156
@property
@@ -74,17 +79,17 @@ def blue(self):
7479
return "%.3f" % (hex_to_rgb(self.hex_color)[2]/255.)
7580

7681
def lighten(self, percent):
77-
"""Lighten color by percent"""
82+
"""Lighten color by percent."""
7883
percent = float(re.sub(r'[\D\.]', '', str(percent)))
7984
return Color(lighten_color(self.hex_color, percent / 100))
8085

8186
def darken(self, percent):
82-
"""Darken color by percent"""
87+
"""Darken color by percent."""
8388
percent = float(re.sub(r'[\D\.]', '', str(percent)))
8489
return Color(darken_color(self.hex_color, percent / 100))
8590

8691
def saturate(self, percent):
87-
"""Saturate a color"""
92+
"""Saturate a color."""
8893
percent = float(re.sub(r'[\D\.]', '', str(percent)))
8994
return Color(saturate_color(self.hex_color, percent / 100))
9095

@@ -103,7 +108,7 @@ def read_file_json(input_file):
103108

104109
def read_file_raw(input_file):
105110
"""Read data from a file as is, don't strip
106-
newlines or other special characters.."""
111+
newlines or other special characters."""
107112
with open(input_file, "r") as file:
108113
return file.readlines()
109114

0 commit comments

Comments
 (0)