diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp index dd5f53e4..fd8f9217 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -239,9 +239,13 @@ void PaletteEditorImGui::drawColorEditor() noexcept { name = currentName; ImGui::InputText("Name", name.data(), name.cap() + 1); ImGui::Separator(); + bool inputFocused = false; ImGui::InputInt("Red", &r, 1, 5); + inputFocused |= ImGui::IsItemFocused(); ImGui::InputInt("Green", &g, 1, 5); + inputFocused |= ImGui::IsItemFocused(); ImGui::InputInt("Blue", &b, 1, 5); + inputFocused |= ImGui::IsItemFocused(); if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) { std::ignore = pushCommand( m_pal, m_page, m_selectedColorRow); @@ -249,6 +253,17 @@ void PaletteEditorImGui::drawColorEditor() noexcept { r = ox::max(r, 0); g = ox::max(g, 0); b = ox::max(b, 0); + if (!inputFocused) { + for (auto i = 0u; i < ox::min(10, largestPage(m_pal)); ++i) { + auto const key = static_cast(ImGuiKey_1 + i); + if (ImGui::IsKeyPressed(key, false)) { + m_selectedColorRow = i; + } + } + if (ImGui::GetIO().KeysDown[ImGuiKey_0]) { + m_selectedColorRow = ox::min(9, largestPage(m_pal)); + } + } auto const newColor = color16(r, g, b, a); if (c != newColor) { std::ignore = pushCommand(m_pal, m_page, m_selectedColorRow, newColor);