diff --git a/src/Palette/PaletteGrid.gd b/src/Palette/PaletteGrid.gd index 89b4633fb..bcb767a78 100644 --- a/src/Palette/PaletteGrid.gd +++ b/src/Palette/PaletteGrid.gd @@ -64,6 +64,7 @@ func draw_palette() -> void: var grid_index := i + grid_size.x * j var index := convert_grid_index_to_palette_index(grid_index) var swatch := swatches[grid_index] + swatch.color_index = index swatch.show_left_highlight = Palettes.left_selected_color == index swatch.show_right_highlight = Palettes.right_selected_color == index var color = current_palette.get_color(index) diff --git a/src/Palette/PaletteSwatch.gd b/src/Palette/PaletteSwatch.gd index bcb6937e2..5259eb157 100644 --- a/src/Palette/PaletteSwatch.gd +++ b/src/Palette/PaletteSwatch.gd @@ -8,6 +8,7 @@ signal dropped(source_index: int, new_index: int) const DEFAULT_COLOR := Color(0.0, 0.0, 0.0, 0.0) var index := -1 +var color_index := -1 var show_left_highlight := false var show_right_highlight := false var empty := true: @@ -48,6 +49,23 @@ func _draw() -> void: draw_rect( Rect2(margin - Vector2.ONE, size - margin * 2 + Vector2(2, 2)), Color.WHITE, false, 1 ) + if Global.show_pixel_indices: + var font := Themes.get_font() + var str_pos := Vector2(size.x / 2, size.y - 2) + var text_color := Global.control.theme.get_color(&"font_color", &"Label") + draw_string_outline( + font, + str_pos, + str(color_index), + HORIZONTAL_ALIGNMENT_RIGHT, + -1, + size.x / 2, + 1, + text_color.inverted() + ) + draw_string( + font, str_pos, str(color_index), HORIZONTAL_ALIGNMENT_RIGHT, -1, size.x / 2, text_color + ) ## Enables drawing of highlights which indicate selected swatches