Merge commit '7688c05bac8c20bc267cae62ec78d55e5d0c493b'

This commit is contained in:
2025-05-31 02:14:15 -05:00
3 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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<Color16>(ox::min<uint8_t>(r, 31))
| static_cast<Color16>(ox::min<uint8_t>(g, 31) << 5)
| static_cast<Color16>(ox::min<uint8_t>(b, 31) << 10)
| static_cast<Color16>(a << 15);
| static_cast<Color16>(ox::min<uint8_t>(g, 31) << 5)
| static_cast<Color16>(ox::min<uint8_t>(b, 31) << 10)
| static_cast<Color16>(a << 15);
}
static_assert(color16(0, 31, 0) == 992);

View File

@ -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<ApplyColorAllPagesCommand>(
m_pal, m_page, m_selectedColorRow);