diff --git a/forms/paletteeditor.ui b/forms/paletteeditor.ui index a8b18de4..12a0213e 100644 --- a/forms/paletteeditor.ui +++ b/forms/paletteeditor.ui @@ -146,6 +146,13 @@ + + + + + + + @@ -237,6 +244,13 @@ + + + + + + + @@ -328,6 +342,13 @@ + + + + + + + @@ -419,6 +440,13 @@ + + + + + + + @@ -510,6 +538,13 @@ + + + + + + + @@ -601,6 +636,13 @@ + + + + + + + @@ -692,6 +734,13 @@ + + + + + + + @@ -783,6 +832,13 @@ + + + + + + + @@ -874,6 +930,13 @@ + + + + + + + @@ -965,6 +1028,13 @@ + + + + + + + @@ -1056,6 +1126,13 @@ + + + + + + + @@ -1147,6 +1224,13 @@ + + + + + + + @@ -1238,6 +1322,13 @@ + + + + + + + @@ -1329,6 +1420,13 @@ + + + + + + + @@ -1420,6 +1518,13 @@ + + + + + + + @@ -1511,6 +1616,13 @@ + + + + + + + diff --git a/include/ui/paletteeditor.h b/include/ui/paletteeditor.h index d8866f24..878455db 100644 --- a/include/ui/paletteeditor.h +++ b/include/ui/paletteeditor.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "project.h" namespace Ui { @@ -22,6 +23,7 @@ private: Project *project = nullptr; QList> sliders; QList frames; + QList rgbLabels; Tileset *primaryTileset; Tileset *secondaryTileset; void disableSliderSignals(); diff --git a/src/ui/paletteeditor.cpp b/src/ui/paletteeditor.cpp index bd67fa5f..b6f21600 100644 --- a/src/ui/paletteeditor.cpp +++ b/src/ui/paletteeditor.cpp @@ -82,6 +82,24 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset this->frames.append(this->ui->frame_15); this->frames.append(this->ui->frame_16); + this->rgbLabels.clear(); + this->rgbLabels.append(this->ui->label_rgb0); + this->rgbLabels.append(this->ui->label_rgb1); + this->rgbLabels.append(this->ui->label_rgb2); + this->rgbLabels.append(this->ui->label_rgb3); + this->rgbLabels.append(this->ui->label_rgb4); + this->rgbLabels.append(this->ui->label_rgb5); + this->rgbLabels.append(this->ui->label_rgb6); + this->rgbLabels.append(this->ui->label_rgb7); + this->rgbLabels.append(this->ui->label_rgb8); + this->rgbLabels.append(this->ui->label_rgb9); + this->rgbLabels.append(this->ui->label_rgb10); + this->rgbLabels.append(this->ui->label_rgb11); + this->rgbLabels.append(this->ui->label_rgb12); + this->rgbLabels.append(this->ui->label_rgb13); + this->rgbLabels.append(this->ui->label_rgb14); + this->rgbLabels.append(this->ui->label_rgb15); + this->initColorSliders(); this->refreshColorSliders(); this->refreshColors(); @@ -141,11 +159,15 @@ void PaletteEditor::refreshColors() { } void PaletteEditor::refreshColor(int colorIndex) { + int red = this->sliders[colorIndex][0]->value() * 8; + int green = this->sliders[colorIndex][1]->value() * 8; + int blue = this->sliders[colorIndex][2]->value() * 8; QString stylesheet = QString("background-color: rgb(%1, %2, %3);") - .arg(this->sliders[colorIndex][0]->value() * 8) - .arg(this->sliders[colorIndex][1]->value() * 8) - .arg(this->sliders[colorIndex][2]->value() * 8); + .arg(red) + .arg(green) + .arg(blue); this->frames[colorIndex]->setStyleSheet(stylesheet); + this->rgbLabels[colorIndex]->setText(QString("RGB(%1, %2, %3)").arg(red).arg(green).arg(blue)); } void PaletteEditor::setPaletteId(int paletteId) {