home | blog | art | now | git gpg | email | rss

morph

Generate xresources colors from an image.
git clone https://pollux.codes/git/morph.git
Log | Files | Refs | README | LICENSE
commit a8543c55e5fbfc29cc61501bfe7bd3b1f9e69bce
parent 52e085886d9c0af301f8e34b0e899ad5e50042ff
Author: Pollux <pollux@pollux.codes>
Date:   Mon, 21 Jul 2025 13:26:11 -0500

feat: Generate complete color theme

Signed-off-by: Pollux <pollux@pollux.codes>

Diffstat:
Mmorph.c | 49+++++++++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/morph.c b/morph.c @@ -290,7 +290,7 @@ cluster_image_colors(col_lab_t *colors, int color_count, int cluster_count) { } } - // TODO OPTIMIZE v1.0: Replace with quickselect followed by partition + // TODO OPTIMIZE v0.2: Replace with quickselect followed by partition switch (largest_dimension) { case 0: @@ -317,7 +317,7 @@ cluster_image_colors(col_lab_t *colors, int color_count, int cluster_count) { clusters[largest_cluster].len /= 2; } - // TODO OPTIMIZE v1.0: Optimize this using quickselect + // TODO OPTIMIZE v0.2: Optimize this using quickselect for(int c = 0; c < cluster_count; c++) { @@ -465,24 +465,33 @@ main(int argc, char **argv) { palette_weights[4 * i + 3] = 0.4; } - TARGET_COLOR("st.color0", 0, 0, 0, 0.25); - TARGET_COLOR("st.color1", 1, 0, 0, 0.7); - TARGET_COLOR("st.color2", 0, 1, 0, 0.7); - TARGET_COLOR("st.color3", 1, 1, 0, 0.7); - TARGET_COLOR("st.color4", 0, 0, 1, 0.7); - TARGET_COLOR("st.color5", 1, 0, 1, 0.7); - TARGET_COLOR("st.color6", 0, 1, 1, 0.7); - TARGET_COLOR("st.color7", 0, 0, 0, 0.9); - TARGET_COLOR("st.color8", 0, 0, 0, 0.4); - TARGET_COLOR("st.color9", 1, 0, 0, 0.8); - TARGET_COLOR("st.color10", 0, 1, 0, 0.8); - TARGET_COLOR("st.color11", 1, 1, 0, 0.8); - TARGET_COLOR("st.color12", 0, 0, 1, 0.8); - TARGET_COLOR("st.color13", 1, 0, 1, 0.8); - TARGET_COLOR("st.color14", 0, 1, 1, 0.8); - TARGET_COLOR("st.color15", 0, 0, 0, 0.9); - TARGET_COLOR("st.surface", 0, 0, 0, 0.15); - TARGET_COLOR("st.on_surface", 0, 0, 0, 0.95); + TARGET_COLOR("*.color0", 0, 0, 0, 0.25); + TARGET_COLOR("*.color1", 1, 0, 0, 0.7); + TARGET_COLOR("*.color2", 0, 1, 0, 0.7); + TARGET_COLOR("*.color3", 1, 1, 0, 0.7); + TARGET_COLOR("*.color4", 0, 0, 1, 0.7); + TARGET_COLOR("*.color5", 1, 0, 1, 0.7); + TARGET_COLOR("*.color6", 0, 1, 1, 0.7); + TARGET_COLOR("*.color7", 0, 0, 0, 0.9); + TARGET_COLOR("*.color8", 0, 0, 0, 0.4); + TARGET_COLOR("*.color9", 1, 0, 0, 0.8); + TARGET_COLOR("*.color10", 0, 1, 0, 0.8); + TARGET_COLOR("*.color11", 1, 1, 0, 0.8); + TARGET_COLOR("*.color12", 0, 0, 1, 0.8); + TARGET_COLOR("*.color13", 1, 0, 1, 0.8); + TARGET_COLOR("*.color14", 0, 1, 1, 0.8); + TARGET_COLOR("*.color15", 0, 0, 0, 0.9); + + TARGET_COLOR("*.base", 0, 0, 0, 0.15); + + TARGET_COLOR("*.surface0", 0, 0, 0, 0.2); + TARGET_COLOR("*.surface1", 0, 0, 0, 0.3); + + TARGET_COLOR("*.text2", 0, 0, 0, 0.7); + TARGET_COLOR("*.text1", 0, 0, 0, 0.8); + TARGET_COLOR("*.text0", 0, 0, 0, 0.95); + + TARGET_COLOR("*.highlight", 0.7, 0.7, 0.7, 0.9); free(image_pixels_rgb); free(image_pixels_lab);