[Palettefx] How to get colors/ sample the palette? #79
-
|
Anyone using Palettefx to get custom colors? I want to use one of the palettes for layer notification, but don't know how to query the palette. I see this in the code for static const uint16_t* palettefx_get_palette_data(void);
static hsv_t palettefx_interp_color(const uint16_t* palette, uint8_t x);Any help / tips / examples would be appreciated. High level I think it would be something like uint16 mypalette = palettefx_get_palette_data();
hsv_t mycolor = palettefx_interp_color(mypalette, 64); // where 64 is the desired h valueOr am I thinking about this wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
@iamdanielv thanks for bringing this up! I had scoped PaletteFx's functions ( I just pushed commit d666813 to revise such that thes functions are now usable from keymap.c (the change amounting to adding their declarations to palettefx.h and removing
This makes it possible to do something like this in keymap.c: const uint16_t* palette = palettefx_get_palette_data_by_index(
PALETTEFX_CARNIVAL);
hsv_t color = palettefx_interp_color(palette, 64); |
Beta Was this translation helpful? Give feedback.
@iamdanielv thanks for bringing this up!
I had scoped PaletteFx's functions (
palettefx_interp_color, etc.) within the file defining RGB matrix effects, thinking that they are only useful there. I had not considered that these functions may be useful outside that context, but you're right, they could be.I just pushed commit d666813 to revise such that thes functions are now usable from keymap.c (the change amounting to adding their declarations to palettefx.h and removing
staticqualifiers):palettefx_get_palette_data()Gets the color data for the selected palette.
palettefx_get_palette_data_by_index(i)Gets the color data for the ith palette.
palettefx_num_palettes()Returns the nu…