mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-16 18:50:19 +00:00
- Added a shared XTextColor definition and a palette conversion helper for Cairo-ready colors, decoupling renderer palettes from GdkColor usage in the API surface.
- Updated xtext palette APIs to accept internal color arrays directly for rendering setup. - Wired xtext palette creation through UI entry points to use the new palette helper when constructing or refreshing text views.
This commit is contained in:
@@ -38,6 +38,18 @@
|
||||
#include "../common/cfgfiles.h"
|
||||
#include "../common/typedef.h"
|
||||
|
||||
static XTextColor
|
||||
palette_color_from_gdk (const GdkColor *color)
|
||||
{
|
||||
XTextColor result;
|
||||
|
||||
result.red = color->red / 65535.0;
|
||||
result.green = color->green / 65535.0;
|
||||
result.blue = color->blue / 65535.0;
|
||||
result.alpha = 1.0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
GdkColor colors[] = {
|
||||
/* colors for xtext */
|
||||
@@ -143,6 +155,18 @@ static const GdkColor dark_colors[MAX_COL + 1] = {
|
||||
{0, 0xf4f4, 0x4747, 0x4747}, /* 41 COL_SPELL (spellcheck underline) */
|
||||
};
|
||||
|
||||
void
|
||||
palette_get_xtext_colors (XTextColor *palette, size_t palette_len)
|
||||
{
|
||||
size_t i;
|
||||
size_t count = palette_len < G_N_ELEMENTS (colors) ? palette_len : G_N_ELEMENTS (colors);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
palette[i] = palette_color_from_gdk (&colors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
palette_user_set_color (int idx, const GdkColor *col)
|
||||
{
|
||||
@@ -399,4 +423,3 @@ palette_apply_dark_mode (gboolean enable)
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user