• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

valeur lumière color

Explorer ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

Bonjour,

 

je souhaite récupérer la valeur de la  lumière d'une couleur avec cette expression, j'ai collé cette expression sur un slider :

c=content("Rectangle 1").content("Fill 1").color;
c = rgbToHsl (c);
c[2];

Seulement la couleur qui est par exemple HSL 0° 47° 31°, l'expression indique  une valeur lumière de 0.24 au lieu de 0.31. Savez pourquoi l'expression n'indique pas 0.31 ?

 

merci

 

 

 

TOPICS
Expressions

Views

314

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

They are still normalized values in a range between 0 and 1, not angles. You need to add another conversion with a linear() expression or whatever if you really need that.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

Merci, vous avez la solution en expression ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

Something like this:

 

linear(c[2],0,1,0,360);

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

merci, mais maintenant j'ai une valeur de 84.70 et non pas 31 !?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

Try changing your last line to:

c[2]*240

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

Merci Dan, mais là je trouve la valeur de 56.47 et toujours pas de 31

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

Can you post a screen capture that show the HSL value in a color picker?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

I think the answer is that the HSB and HSL color models are different, especially for the Brightness (B) vs Lightness (L) components. There are formulas out there to convert L to B if you really need it, but I've never tried it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

Thanks Dan, just for fun it would be interesting, right?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

OK, just for fun, try this:

c = content("Rectangle 1").content("Fill 1").color;
hsl = rgbToHsl(c);
s = hsl[1];
l = hsl[2];
t = s*(l < .5 ? l : 1-l);
b = t + l;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

LATEST

trop fort MERCI BEAUCOUP ! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines