@@ -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
104109def 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