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

lighten and darken fail with RGB colors #1

Open
stam66 opened this issue Mar 5, 2022 · 2 comments
Open

lighten and darken fail with RGB colors #1

stam66 opened this issue Mar 5, 2022 · 2 comments

Comments

@stam66
Copy link
Contributor

stam66 commented Mar 5, 2022

I'm having an issue with lighten/darken (not tested other functions yet). If i pass a colorName or hex value, these all work as expected.

However if i pass the color of a control (which is set as an RGB value) or if i simply pass an RGB value, darken returns black and lighten returns a dark grey, no matter what color is passed as RBG.

The attached stack is a simple test - the buttons on the left assign aa color to 'source' by color name, RGB or hex, the buttons on the right lighten/darken the 'destination' graphic based on the 'source' background color.
tinyColor test.livecode.zip

@stam66
Copy link
Contributor Author

stam66 commented Mar 6, 2022

Further to this, i realised the issue - the input is expected to be in the format RGB(r, g, b) instead of "r, g, b" - the latter is common usage in livecode and this therefore causes issues.

For example, passing darken("RGB(255,104,110)", 30) works as expected, but passing darken("255,104,110", 30) fails - the RBG values in sColor are all 0.

Could i therefore make a request to parse "r, g, b" as an RGB triplet without the qualifier 'RGB()', as is commonly the case in LiveCode?

Thank you

@stam66
Copy link
Contributor Author

stam66 commented Mar 6, 2022

A small addition to inputToRGB handler fixes this issue - in other words, statements like darken(the backgroundColor of graphic 1, 25) will now work as expected instead of returning 0,0,0.

I'm made a pull request with this working fix - it's my first pull request so apologies if it's not done correctly!

torocruzand pushed a commit that referenced this issue Mar 6, 2022
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

No branches or pull requests

1 participant