Satty icon indicating copy to clipboard operation
Satty copied to clipboard

Using "Customize" in the color picker results in two new color swatches

Open wixoff opened this issue 1 month ago • 4 comments

Version

0.20.0-1.fc42 from solopasha:hyprland fedora copr repo

Description

This is pretty straightforward to explain:

When changing a custom color in the picker ([right click] -> Customize) two new color swatches are generated. The original swatch isn't changed, and two identical new ones appear at the left side of the list.

Image

I'm using satty in niri, activated directly via keybind and pulling in the clipboard via wl-paste.

wixoff avatar Nov 06 '25 16:11 wixoff

Upon further review, it appears the two adjacent colors are not exactly the same, but very similar. The palette screenshot below contains these values (copied from org/gtk/gtk4/settings/color-chooser/custom-colors in dconf-editor):

[
  (0.08235294371843338, 0.30196079611778259, 0.10196078568696976, 1.0), 
  (0.0849333256483078, 0.3033333420753479, 0.10240530967712402, 1.0), 

  (0.21960784494876862, 0.40392157435417175, 0.58823531866073608, 1.0),
  (0.22223332524299622, 0.40611663460731506, 0.5899999737739563, 1.0),

  (0.92156863212585449, 0.30196079611778259, 0.29411765933036804, 1.0),

  (0.10196078568696976, 0.062745101749897003, 0.14509804546833038, 1.0),
  (0.10474631935358047, 0.066488884389400482, 0.14666666090488434, 1.0),

  (0.3686276376247406, 0.0, 0.77254903316497803, 1.0)
]

(I have manually added spacing to the value above to show the color pairs next to each other.)

Image

wixoff avatar Nov 06 '25 16:11 wixoff

I think these are two different things. Or three even.

  1. The lack of replacement with right-click, customize can be reproduced with a small C demo. It just replaces the "oldest" one on the right. Seems to happen in the newer ColorDialog as well. Perhaps it's intended, but we should probably open a bug report in gtk.

  2. The duplication I only see in Satty, could be something we do. I could be mistaken as I only had a quick glance, but I think what happens is this: Gtk tracks its own "custom colors" in the bottom line, I haven't tried to find out where/how it's stored. But that includes the last customized colour. And we also pass OUR current custom color to the dialog. I think Gtk would even prevent duplicates there, but then there's the small nuanced difference you spotted.

And that brings me to

  1. Nuanced difference in colours: I have absolutely no idea where that one comes from 😆

RobertMueller2 avatar Nov 06 '25 17:11 RobertMueller2

Re 3, gtk RGBA uses floats, we use ints for our own colour representation. Could be the conversion. Need to confirm that of course, but if that's the case we might be able to switch to float ourselves. Femtovg uses floats as well. Not sure if we need int values anywhere else.

RobertMueller2 avatar Nov 06 '25 17:11 RobertMueller2

Regarding number 3, I too thought it might be some kind of quantization/conversion error, but it is strange that all of those values are found in the gtk dconf key/value registry, and only some of them are altered.

wixoff avatar Nov 06 '25 20:11 wixoff