mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
ColorEdit: "Copy As" context-menu tool shows hex values with a '#' prefix instead of '0x' + both with/without alpha when available.
This commit is contained in:
parent
ff5299e0e0
commit
f56962cb9a
2 changed files with 9 additions and 4 deletions
|
|
@ -5022,12 +5022,15 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
|||
ImFormatString(buf, IM_ARRAYSIZE(buf), "(%d,%d,%d,%d)", cr, cg, cb, ca);
|
||||
if (Selectable(buf))
|
||||
SetClipboardText(buf);
|
||||
if (flags & ImGuiColorEditFlags_NoAlpha)
|
||||
ImFormatString(buf, IM_ARRAYSIZE(buf), "0x%02X%02X%02X", cr, cg, cb);
|
||||
else
|
||||
ImFormatString(buf, IM_ARRAYSIZE(buf), "0x%02X%02X%02X%02X", cr, cg, cb, ca);
|
||||
ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", cr, cg, cb);
|
||||
if (Selectable(buf))
|
||||
SetClipboardText(buf);
|
||||
if (!(flags & ImGuiColorEditFlags_NoAlpha))
|
||||
{
|
||||
ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X%02X", cr, cg, cb, ca);
|
||||
if (Selectable(buf))
|
||||
SetClipboardText(buf);
|
||||
}
|
||||
EndPopup();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue