@@ -63,7 +63,10 @@ def rgba_color(self):
63
63
"""Returns the color in the line, if any rgba is found."""
64
64
matches = re .search (Line .RGBA_REGEXP , self .text )
65
65
if matches :
66
- return 'rgb(' + matches .group (1 ) + ')'
66
+ if self .transparency_settings ()[0 ]:
67
+ return matches .group (0 )
68
+ else :
69
+ return 'rgb(' + matches .group (1 ) + ')'
67
70
68
71
def hsl_color (self ):
69
72
"""Returns the color in the line, if any hsl is found."""
@@ -75,7 +78,10 @@ def hsla_color(self):
75
78
"""Returns the color in the line, if any rgba is found."""
76
79
matches = re .search (Line .HSLA_REGEXP , self .text )
77
80
if matches :
78
- return 'hsl(' + matches .group (1 ) + ')'
81
+ if self .transparency_settings ()[0 ]:
82
+ return matches .group (0 )
83
+ else :
84
+ return 'hsl(' + matches .group (1 ) + ')'
79
85
80
86
def custom_color (self ):
81
87
"""Returns the color in the line, if any user-defined is found."""
@@ -112,6 +118,20 @@ def erase_region(self):
112
118
"""Remove icon from the gutter"""
113
119
self .view .erase_regions ("gutter_color_%s" % self .region .a )
114
120
121
+ def transparency_settings (self ):
122
+ from .gutter_color import current_directory
123
+ # transparency settings
124
+ use_transparency = self .settings .get ("use_transparency" )
125
+ if use_transparency == True :
126
+ background_path = os .path .join (current_directory (True ),"transparency_circle_mid.png" )
127
+ elif use_transparency in ("light" , "mid" ):
128
+ background_path = os .path .join (current_directory (True ),str ("transparency_circle_" + use_transparency + ".png" ))
129
+ print (background_path )
130
+ use_transparency = True
131
+ else :
132
+ use_transparency = False
133
+ return (use_transparency , background_path )
134
+
115
135
def create_icon (self ):
116
136
paths = [
117
137
"/usr/bin/convert" ,
@@ -138,11 +158,18 @@ def create_icon(self):
138
158
convert_path = path
139
159
break
140
160
161
+ (use_transparency , background_path ) = self .transparency_settings ()
162
+
141
163
"""Create the color icon using ImageMagick convert"""
142
- script = "\" %s\" -units PixelsPerCentimeter -type TrueColorMatte -channel RGBA " \
143
- "-size 32x32 -alpha transparent xc:none " \
144
- "-fill \" %s\" -draw \" circle 15,16 8,10\" png32:\" %s\" " % \
145
- (convert_path , self .color (), self .icon_path ())
164
+ if not use_transparency :
165
+ script = "\" %s\" -units PixelsPerCentimeter -type TrueColorMatte -channel RGBA " \
166
+ "-size 32x32 -alpha transparent xc:none " \
167
+ "-fill \" %s\" -draw \" circle 15,16 8,10\" png32:\" %s\" " % \
168
+ (convert_path , self .color (), self .icon_path ())
169
+ else :
170
+ script = "\" %s\" \" %s\" -type TrueColorMatte -channel RGBA " \
171
+ "-fill \" %s\" -draw \" circle 15,16 8,10\" png32:\" %s\" " % \
172
+ (convert_path , background_path , self .color (), self .icon_path ())
146
173
if not isfile (self .icon_path ()):
147
174
pr = subprocess .Popen (script ,
148
175
shell = True ,
0 commit comments