Merge commit '7688c05bac8c20bc267cae62ec78d55e5d0c493b'
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* Add ability to remember recent projects in config
|
* Add ability to remember recent projects in config
|
||||||
* PaletteEditor: Add RGB key shortcuts for focusing color channels
|
* PaletteEditor: Add RGB key shortcuts for focusing color channels
|
||||||
|
* PaletteEditor: Add color preview to color editor
|
||||||
|
|
||||||
# d2025.05.2
|
# d2025.05.2
|
||||||
|
|
||||||
|
@ -142,9 +142,9 @@ constexpr Color16 color16(int r, int g, int b, int a = 0) noexcept {
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0) noexcept {
|
constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0) noexcept {
|
||||||
return static_cast<Color16>(ox::min<uint8_t>(r, 31))
|
return static_cast<Color16>(ox::min<uint8_t>(r, 31))
|
||||||
| static_cast<Color16>(ox::min<uint8_t>(g, 31) << 5)
|
| static_cast<Color16>(ox::min<uint8_t>(g, 31) << 5)
|
||||||
| static_cast<Color16>(ox::min<uint8_t>(b, 31) << 10)
|
| static_cast<Color16>(ox::min<uint8_t>(b, 31) << 10)
|
||||||
| static_cast<Color16>(a << 15);
|
| static_cast<Color16>(a << 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
static_assert(color16(0, 31, 0) == 992);
|
static_assert(color16(0, 31, 0) == 992);
|
||||||
|
@ -307,6 +307,15 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
|||||||
colorInput("Red", r, inputFocused, FocusCmd::Red);
|
colorInput("Red", r, inputFocused, FocusCmd::Red);
|
||||||
colorInput("Green", g, inputFocused, FocusCmd::Green);
|
colorInput("Green", g, inputFocused, FocusCmd::Green);
|
||||||
colorInput("Blue", b, inputFocused, FocusCmd::Blue);
|
colorInput("Blue", b, inputFocused, FocusCmd::Blue);
|
||||||
|
// color preview
|
||||||
|
{
|
||||||
|
ImGui::PushStyleColor(
|
||||||
|
ImGuiCol_ChildBg,
|
||||||
|
color32(color16(r, g, b)) | 0xff'00'00'00);
|
||||||
|
ImGui::BeginChild("ColorPreview", {0, 25});
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
}
|
||||||
if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) {
|
if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) {
|
||||||
std::ignore = pushCommand<ApplyColorAllPagesCommand>(
|
std::ignore = pushCommand<ApplyColorAllPagesCommand>(
|
||||||
m_pal, m_page, m_selectedColorRow);
|
m_pal, m_page, m_selectedColorRow);
|
||||||
|
Reference in New Issue
Block a user