Skip to content

Highlights: improve 'Set color' dialog#14699

Merged
hius07 merged 16 commits into
koreader:masterfrom
hius07:colored-button
Jan 30, 2026
Merged

Highlights: improve 'Set color' dialog#14699
hius07 merged 16 commits into
koreader:masterfrom
hius07:colored-button

Conversation

@hius07

@hius07 hius07 commented Dec 7, 2025

Copy link
Copy Markdown
Member

shrink_unneeded_width = false, -- have 'width' meaning 'max_width'
shrink_min_width = nil, -- default to ButtonTable's default
tap_close_callback = nil,
colorful = false, -- should be set to true if any of the buttons' text is colorful

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colourful usually means, that something has a lot of colour and is vibrant (is not the opposite of monochromatic). I would suggest you find a different name as that is not what seems to be the case here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not my naming.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't a plain color be enough?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a @NiLuJe 's word from #11044.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was a call point with color in there already (at least at some point), which explains the roundabout naming. (I was never really happy with it, though, so if you find something better, go ahead).

Basically, the idea was to not confuse that with setting an actual color (which is what our color variables usually mean), hence colored/colorful ;).

@VeeBui

VeeBui commented Dec 11, 2025

Copy link
Copy Markdown

@NiLuJe and possibly @hius07 too. Sorry, not sure how to message you guys otherwise, but I've been thinking about making a discord server for KOReader for a while, and as I think you guys maybe are some of the main contributors or possibly are in charge of this repo, I'd like to talk to you about it. You can reply here, or I'm veevui on discord or veeevui on reddit.

Comment on lines +43 to +46
function ReaderHighlight:getHighlightColorHash(color)
return Blitbuffer.colorFromName(color) --- @todo fix in the night mode; issue #14170, #14667
or Blitbuffer.gray(self.view.highlight.lighten_factor) -- 'gray' or unknown color
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible I see too much of the word "hash" in crengine and at work, and it evokes for me https://en.wikipedia.org/wiki/Hash_function (and not being young, it doesn't evoke "hash tag koreader" at all :)).
I think here, it returns the hex value (#BB4499) of that color ?
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value calls it "hex color".
So, maybe getHighlightColorAsHexColor or getHighlightHexColor ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it means hex I didn't realize from the name either. ;-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns ColorRGB32 or Color8 structure.
Isn't it a "hash table"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, a hash table ala Lua (ie. not an array-like table).
But here, that hash table would not really be just a hash table, but more like an object, an instance of these struct, which are somehow subclasses of the generic class Color (even if it doesn't exist, haven't checked).
So, then, it just returns a "color", what we use everywhere we set color = (ie. Blitbuffer.COLOR_DARK_GRAY).
So, just getHighlightColor(color_name) ?

@hius07

hius07 commented Jan 19, 2026

Copy link
Copy Markdown
Member Author

@Frenzie, koreader/koreader-base#2233 is waiting for you. NiLuJe has approved.

@Frenzie

Frenzie commented Jan 19, 2026

Copy link
Copy Markdown
Member

@hius07 Are you just asking if I also think it's good or do you mean I didn't give you the necessary access rights?

@hius07

hius07 commented Jan 19, 2026

Copy link
Copy Markdown
Member Author

In any case your "okay" is desirable.

@Frenzie

Frenzie commented Jan 19, 2026

Copy link
Copy Markdown
Member

Fair enough.

@hius07 hius07 merged commit b2b02e7 into koreader:master Jan 30, 2026
4 checks passed
@hius07 hius07 deleted the colored-button branch January 30, 2026 05:50
@hius07 hius07 added this to the 2026.01 milestone Jan 30, 2026
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: ReaderHighlight: Directly apply style/color selection

6 participants