Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFACTOR: Change how colors are handled internally (& externally) with update_tab_color #1213

Closed
alifeee opened this issue Jun 7, 2023 · 1 comment
Assignees
Milestone

Comments

@alifeee
Copy link
Collaborator

alifeee commented Jun 7, 2023

There are many problems with how colors are currently set/read. See #1199.

The main issue is that if you send a color of 0.5 to Google, the color is set to 0.49803922 (closest 8-bit value).

This issue proposes that we change how colors are implemented to align to this 8-bit-ness.

old

color = {
  "red": 0,
  "green": 0.5,
  "blue": 1
}

new

unsure which of these is best

color = "#FF8000"
color = [255, 128, 0]
color = {
  "red": 255,
  "green": 128,
  "blue": 0
}

More discussion in #1199

Thinking about it:

  • the API uses float values
  • but colors are always set using integer between [0:255]
  • why do we have to ask the user for a float and then change it 🧐

Can't we use whol numbers from 0 to 255 do the computation for the API and then return the appropriate value for the user ?

You see what I mean?

Btw: that's a breaking change 😛

  1. a new method to set the color of a tab, something like: set_tab_color(hex_color) that takes only a color as hex value
  2. a new function in utils.py that can convert a color from 3 arguments to a hex value: convert_colors_to_hex_value(red, gree, blue) this > way a user can use it 2 in ways seamlessly:
    1. using direct argument assignment: ..._hex_value(123,43,12)
    2. using named arguments: ..._hex_value(red=123, green=43, blue=12)
@alifeee alifeee added this to the 6.0.0 milestone Jun 8, 2023
@alifeee alifeee self-assigned this Jun 29, 2023
@lavigne958
Copy link
Collaborator

closed by #1270

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants