summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn3rdopolis <bluescreen_avenger@verizon.net>2023-03-19 22:40:52 -0400
committerRay Strode <rstrode@redhat.com>2023-12-02 18:14:42 -0500
commit328a61cf51bc6626b403ac98b52bdbbd64ef5419 (patch)
tree8bd233e85c31fc5236317073e103afc7b5f17503
parente0a8a9973b824b168c82d4865f75943eb4b10e7b (diff)
ply-label: Add ply_label_set_hex_color () based off of ply_pixel_buffer_fill_with_hex_color for configuration of label text colors
-rw-r--r--src/libply-splash-graphics/ply-label.c24
-rw-r--r--src/libply-splash-graphics/ply-label.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/libply-splash-graphics/ply-label.c b/src/libply-splash-graphics/ply-label.c
index f3a99fd8..ecb79404 100644
--- a/src/libply-splash-graphics/ply-label.c
+++ b/src/libply-splash-graphics/ply-label.c
@@ -335,6 +335,30 @@ ply_label_set_font (ply_label_t *label,
}
void
+ply_label_set_hex_color (ply_label_t *label,
+ uint32_t hex_color)
+{
+ double red;
+ double green;
+ double blue;
+ double alpha;
+
+ red = ((double) (hex_color & 0xff000000) / 0xff000000);
+ green = ((double) (hex_color & 0x00ff0000) / 0x00ff0000);
+ blue = ((double) (hex_color & 0x0000ff00) / 0x0000ff00);
+ alpha = ((double) (hex_color & 0x000000ff) / 0x000000ff);
+
+ if (label->plugin_interface == NULL)
+ return;
+
+ label->plugin_interface->set_color_for_control (label->control,
+ red,
+ green,
+ blue,
+ alpha);
+}
+
+void
ply_label_set_color (ply_label_t *label,
float red,
float green,
diff --git a/src/libply-splash-graphics/ply-label.h b/src/libply-splash-graphics/ply-label.h
index 085aa692..5f4e6e81 100644
--- a/src/libply-splash-graphics/ply-label.h
+++ b/src/libply-splash-graphics/ply-label.h
@@ -72,6 +72,8 @@ void ply_label_set_width (ply_label_t *label,
long width);
void ply_label_set_font (ply_label_t *label,
const char *fontdesc);
+void ply_label_set_hex_color (ply_label_t *label,
+ uint32_t hex_color);
void ply_label_set_color (ply_label_t *label,
float red,
float green,