[geany/geany-plugins] 062865: Merge pull request #965 from M-HT/markdown_fix_colors

Frank Lanitz git-noreply at xxxxx
Wed May 13 08:00:51 UTC 2020


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   GitHub <noreply at github.com>
Date:        Wed, 13 May 2020 08:00:51 UTC
Commit:      062865e3b57a3baa882f69e4f3bc291278c200e4
             https://github.com/geany/geany-plugins/commit/062865e3b57a3baa882f69e4f3bc291278c200e4

Log Message:
-----------
Merge pull request #965 from M-HT/markdown_fix_colors

Markdown: fix colors in gtk3


Modified Paths:
--------------
    markdown/src/markdown-gtk-compat.c

Modified: markdown/src/markdown-gtk-compat.c
19 lines changed, 10 insertions(+), 9 deletions(-)
===================================================================
@@ -78,9 +78,10 @@ GtkWidget *markdown_gtk_color_button_new_with_color(MarkdownColor *color)
 #else
 {
   GdkRGBA clr;
-  clr.red = color->red / 256.0;
-  clr.green = color->green / 256.0;
-  clr.blue = color->blue / 256.0;
+  clr.red = color->red / 255.0;
+  clr.green = color->green / 255.0;
+  clr.blue = color->blue / 255.0;
+  clr.alpha = 1.0;
 # if !GTK_CHECK_VERSION(3, 4, 0)
   gtk_color_button_set_rgba(GTK_COLOR_BUTTON(btn), &clr);
 # else
@@ -112,9 +113,9 @@ gboolean markdown_color_parse(const gchar *spec, MarkdownColor *color)
   GdkRGBA clr;
   result = gdk_rgba_parse(&clr, spec);
   if (result) {
-    color->red = (guint8) (clr.red * 256.0);
-    color->green = (guint8) (clr.green * 256.0);
-    color->blue = (guint8) (clr.blue * 256.0);
+    color->red = (guint8) (clr.red * 255.0);
+    color->green = (guint8) (clr.green * 255.0);
+    color->blue = (guint8) (clr.blue * 255.0);
   }
 }
 #endif
@@ -140,8 +141,8 @@ void markdown_gtk_color_button_get_color(GtkColorButton *button, MarkdownColor *
 # else
   gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &clr);
 # endif
-  color->red = (guint8) (clr.red * 256.0);
-  color->green = (guint8) (clr.green * 256.0);
-  color->blue = (guint8) (clr.blue * 256.0);
+  color->red = (guint8) (clr.red * 255.0);
+  color->green = (guint8) (clr.green * 255.0);
+  color->blue = (guint8) (clr.blue * 255.0);
 #endif
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list