glenelkins1984 Posted February 23, 2018 Share Posted February 23, 2018 Using PSD.js the colours for text characters don't match RGB,RGBA or CMYK, there are 5 numbers in the a colour arrays, they don't even match the text colour in the photoshop file if you try to compare any of the numbers to the RBG or CMYK values. An example what PSD.js is showing for colours of a particular part of text shows this array: [3] => Array([0] => 27[1] => 185[2] => 116[3] => 0[4] => 255) You can clearly see these have no relevance to any colour codes I have seen before. These numbers are supposedly representing this colour: #db6971 - but none of the numbers match anything, the RGB for that is 219,105,113 and CMYK is 11%,72%,46%,0% So does anyone have a clue what is going on here? I am trying to render this text to html but I can't set the colour without actually knowing what these numbers are supposed to mean. Can't get an answer from the library developer on this. Quote Link to comment https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/ Share on other sites More sharing options...
dalecosp Posted February 23, 2018 Share Posted February 23, 2018 Have you tried an inverse mapping? (255 minus value?) Quote Link to comment https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/#findComment-1556672 Share on other sites More sharing options...
requinix Posted February 24, 2018 Share Posted February 24, 2018 27 / 255 ≈ 11% 1 Quote Link to comment https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/#findComment-1556676 Share on other sites More sharing options...
dalecosp Posted February 26, 2018 Share Posted February 26, 2018 27 / 255 ≈ 11%Nice catch! Was that off the top of your head, or did you read more of the code than I did? Quote Link to comment https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/#findComment-1556748 Share on other sites More sharing options...
requinix Posted February 26, 2018 Share Posted February 26, 2018 Was that off the top of your head, or did you read more of the code than I did?I just noticed there was a correlation between the 27/185/116/0 and the 11%/72%/46%/0%. PSDs are primarily about printing so CYMK would be more appropriate than RGB. The final 255 could easily be alpha/opacity. The true answer is probably buried somewhere in the PSD spec but it's not the easiest thing to read through. 1 Quote Link to comment https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/#findComment-1556749 Share on other sites More sharing options...
dalecosp Posted February 26, 2018 Share Posted February 26, 2018 (edited) Again, nice work. I read some of the source for PSD.js at Github and had figured it was CMYK because that array had 5 elements, but the values in the CoffeeScript there were still all 8-bit based and I didn't have time to track down through the rest of the system to see how the math worked ... Edited February 26, 2018 by dalecosp Quote Link to comment https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/#findComment-1556750 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.