Fixing color convert; adding more to src view preview; usr dir changes

This commit is contained in:
itdominator 2023-10-22 21:46:50 -05:00
parent 7f3ea8c146
commit 66491a6198

View File

@ -18,13 +18,10 @@ class MainSignalsMixin(ListSignalsMixin, TggleAndCheckBoxSignals, SourceviewSign
if self.selected_style_id not in self.all_styles_dict:
self.all_styles_dict[self.selected_style_id] = StyleProperties()
color_scale = 255.0/65535.0
if data == self.br_color_btn:
color = data.get_color()
self.all_styles_dict[self.selected_style_id].background = ('#%02x%02x%02x' % (color.red * color_scale, color.green * color_scale, color.blue * color_scale))
self.all_styles_dict[self.selected_style_id].background = self.get_hex(data)
elif data == self.fr_color_btn:
color = data.get_color()
self.all_styles_dict[self.selected_style_id].foreground = ('#%02x%02x%02x' % (color.red * color_scale, color.green * color_scale, color.blue * color_scale))
self.all_styles_dict[self.selected_style_id].foreground = self.get_hex(data)
elif data == self.bold_tggle_btn:
self.all_styles_dict[self.selected_style_id].bold = data.get_active()
elif data == self.italic_tggle_btn:
@ -35,3 +32,12 @@ class MainSignalsMixin(ListSignalsMixin, TggleAndCheckBoxSignals, SourceviewSign
self.all_styles_dict[self.selected_style_id].strikethrough = data.get_active()
self.update_sample_view()
def get_hex(self, data):
color_scale = 255.0 / 65535.0
color = data.get_color()
red = color.red * color_scale
green = color.green * color_scale
blue = color.blue * color_scale
return ('#%02x%02x%02x' % (int(red), int(green), int(blue)))