pidgin/gtkstyle.c

changeset 39277
68c17ba18f33
parent 38699
e7b5011e4728
equal deleted inserted replaced
39276:89f307c3aa27 39277:68c17ba18f33
45 45
46 return dark_mode_cache; 46 return dark_mode_cache;
47 } 47 }
48 48
49 void 49 void
50 pidgin_style_adjust_contrast(GtkStyle *style, GdkColor *color) { 50 pidgin_style_adjust_contrast(GtkStyle *style, GdkRGBA *rgba) {
51 if (pidgin_style_is_dark(style)) { 51 if (pidgin_style_is_dark(style)) {
52 gdouble r, g, b, h, s, v; 52 gdouble h, s, v;
53 53
54 r = ((gdouble) color->red) / 65535.0; 54 gtk_rgb_to_hsv(rgba->red, rgba->green, rgba->blue, &h, &s, &v);
55 g = ((gdouble) color->green) / 65535.0;
56 b = ((gdouble) color->blue) / 65535.0;
57
58 gtk_rgb_to_hsv(r, g, b, &h, &s, &v);
59 55
60 v += 0.3; 56 v += 0.3;
61 v = v > 1.0 ? 1.0 : v; 57 v = v > 1.0 ? 1.0 : v;
62 s = 0.7; 58 s = 0.7;
63 59
64 gtk_hsv_to_rgb(h, s, v, &r, &g, &b); 60 gtk_hsv_to_rgb(h, s, v, &rgba->red, &rgba->green, &rgba->blue);
65
66 color->red = (guint16) (r * 65535.0);
67 color->green = (guint16) (g * 65535.0);
68 color->blue = (guint16) (b * 65535.0);
69 } 61 }
70 } 62 }

mercurial