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

valeur lumière color

Explorer ,
Nov 22, 2023 Nov 22, 2023

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
1.4K
Translate
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

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

Translate
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

Merci, vous avez la solution en expression ?

Translate
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

Something like this:

 

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

 

Mylenium

Translate
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

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

Translate
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

Try changing your last line to:

c[2]*240
Translate
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

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

Translate
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

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

Translate
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
 
Translate
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

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.

Translate
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

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

Translate
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

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;
Translate
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
LATEST

trop fort MERCI BEAUCOUP ! 

Translate
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