diff --git a/release-notes.md b/release-notes.md index b0c4b38..377c1c1 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,6 +2,7 @@ * Add ability to remember recent projects in config * PaletteEditor: Add RGB key shortcuts for focusing color channels +* PaletteEditor: Add color preview to color editor # d2025.05.2 diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp index 68f17a5..f59dc82 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp @@ -142,9 +142,9 @@ constexpr Color16 color16(int r, int g, int b, int a = 0) noexcept { [[nodiscard]] constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0) noexcept { return static_cast(ox::min(r, 31)) - | static_cast(ox::min(g, 31) << 5) - | static_cast(ox::min(b, 31) << 10) - | static_cast(a << 15); + | static_cast(ox::min(g, 31) << 5) + | static_cast(ox::min(b, 31) << 10) + | static_cast(a << 15); } static_assert(color16(0, 31, 0) == 992); diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp index 8b2847f..af8d051 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -307,6 +307,15 @@ void PaletteEditorImGui::drawColorEditor() noexcept { colorInput("Red", r, inputFocused, FocusCmd::Red); colorInput("Green", g, inputFocused, FocusCmd::Green); 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})) { std::ignore = pushCommand( m_pal, m_page, m_selectedColorRow);