[nostalgia/core/studio] Add color preview to color picker in TileSheetEditor

This commit is contained in:
Gary Talent 2022-02-16 20:52:34 -06:00
parent 462375aa5d
commit 22216c66d6

View File

@ -108,8 +108,9 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
void TileSheetEditorImGui::drawPalettePicker() noexcept {
// header
if (ImGui::BeginTable("PaletteTable", 2, ImGuiTableFlags_RowBg)) {
ImGui::TableSetupColumn("No.", 0, 0.35);
if (ImGui::BeginTable("PaletteTable", 3, ImGuiTableFlags_RowBg)) {
ImGui::TableSetupColumn("No.", 0, 0.45);
ImGui::TableSetupColumn("", 0, 0.22);
ImGui::TableSetupColumn("Color16", 0, 3);
ImGui::TableHeadersRow();
for (auto i = 0u; auto c: m_tileSheetEditor.pal().colors) {
@ -123,6 +124,9 @@ void TileSheetEditorImGui::drawPalettePicker() noexcept {
}
// Column: color RGB
ImGui::TableNextColumn();
auto ic = ImGui::GetColorU32(ImVec4(redf(c), greenf(c), bluef(c), 1));
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ic);
ImGui::TableNextColumn();
ImGui::Text("(%02d, %02d, %02d)", red16(c), green16(c), blue16(c));
ImGui::TableNextRow();
ImGui::PopID();