update colors on HEX clipboard paste
This commit is contained in:
@@ -93,7 +93,7 @@ void NodeColorPicker::init_controls()
|
|||||||
m_btn_paste->on_click = [this](Node*)
|
m_btn_paste->on_click = [this](Node*)
|
||||||
{
|
{
|
||||||
std::string s = App::I->clipboard_get_text();
|
std::string s = App::I->clipboard_get_text();
|
||||||
std::regex r("#([\\dabcdefABCDEF]{6})");
|
std::regex r("#?([\\dabcdefABCDEF]{6})");
|
||||||
std::smatch m;
|
std::smatch m;
|
||||||
if (std::regex_search(s, m, r))
|
if (std::regex_search(s, m, r))
|
||||||
{
|
{
|
||||||
@@ -103,6 +103,8 @@ void NodeColorPicker::init_controls()
|
|||||||
uint8_t r = (ul >> 16) & 0xFF;
|
uint8_t r = (ul >> 16) & 0xFF;
|
||||||
auto rgb = glm::vec3(r, g, b) / 255.f;
|
auto rgb = glm::vec3(r, g, b) / 255.f;
|
||||||
set_color(rgb);
|
set_color(rgb);
|
||||||
|
if (on_color_change)
|
||||||
|
on_color_change(this, rgb);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user