1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-23 01:32:22 -05:00

XEP-0392: update to version 0.6.0

CVD rule fixes, test vector update
This commit is contained in:
Jonas Schäfer 2018-10-02 18:16:25 +02:00
parent 5898d845ec
commit 1496bd3a01

View File

@ -23,6 +23,16 @@
<supersededby/> <supersededby/>
<shortname>colors</shortname> <shortname>colors</shortname>
&jonaswielicki; &jonaswielicki;
<revision>
<version>0.6.0</version>
<date>2018-10-02</date>
<initials>jsc</initials>
<remark>
<p>Fix CVD rules: they were incorrect in the last update.</p>
<p>Update test vectors after CVD fix.</p>
<p>Add note about floating-point modulo operator implementation interoperability.</p>
</remark>
</revision>
<revision> <revision>
<version>0.5</version> <version>0.5</version>
<date>2018-10-01</date> <date>2018-10-01</date>
@ -151,13 +161,14 @@
<p>Input: Hue angle.</p> <p>Input: Hue angle.</p>
<p>Output: Hue angle.</p> <p>Output: Hue angle.</p>
<p>Note: This algorithm will re-map the angle to map it away from ranges which can not be distinguished by people with the respective &cvds;.</p> <p>Note: This algorithm will re-map the angle to map it away from ranges which can not be distinguished by people with the respective &cvds;.</p>
<p>Note: Some floating-point modulo implementations will return negative outputs for negative inputs. This algorithm assumes that your implementation returns <em>non-negative</em> outputs for all inputs.</p>
<section3 topic='Red/Green-blindness' anchor='algorithm-cvd-rg'> <section3 topic='Red/Green-blindness' anchor='algorithm-cvd-rg'>
<p>Take the angle modulo 180 and subtract 90.</p> <p>Add 90 to the angle, take it modulo 180 and subtract 90. Take the result modulo 360 to ensure that it's in the range from 0 to 360.</p>
<p>Note: the same effect can be achieved by forcing the two most-significant bits of the angle to be equal to the second-most-significant bit before converting to a float in <link url="#algorithm-angle">Angle generation</link>. This avoids having to perform a floating-point modulo operation.</p> <p>Note: the same effect can be achieved by forcing the two most-significant bits of the angle to be equal to the second-most-significant bit before converting to a float in <link url="#algorithm-angle">Angle generation</link>. This avoids having to perform a floating-point modulo operation.</p>
</section3> </section3>
<section3 topic='Blue-blindness' anchor='algorithm-cvd-b'> <section3 topic='Blue-blindness' anchor='algorithm-cvd-b'>
<p>Subtract 90 from the angle, take the result modulo 180.</p> <p>Take the angle modulo 180.</p>
<p>Note: the same effect can be achieved by setting the second-most-significant bit of the angle to the inverse of the most-significant bit and then setting the most-significant bit to zero before conversion to floating point in <link url="#algorithm-angle">Angle generation</link>. This avoids having to perform a floating-point modulo operation.</p> <p>Note: the same effect can be achieved by setting the most-significant bit to zero before conversion to floating point in <link url="#algorithm-angle">Angle generation</link>. This avoids having to perform a floating-point modulo operation.</p>
</section3> </section3>
</section2> </section2>
<section2 topic='Adapting the Color for specific Background Colors' anchor='algorithm-bg'> <section2 topic='Adapting the Color for specific Background Colors' anchor='algorithm-bg'>
@ -298,54 +309,54 @@ bc = 0.2*bb_inv + 0.8*bi;]]></code></li>
<p>This section holds test vectors for the different configurations. The test vectors are provided as Comma Separated Values. Strings are enclosed by single quotes (&apos;). The first line contains a header. Each row contains, in that order, the original text, the text encoded as UTF-8 as hexadecimal octets, the angle in degrees, the calculated hue in degrees (differs from angle only for CVD-corrected rows), and the Red, Green, and Blue values.</p> <p>This section holds test vectors for the different configurations. The test vectors are provided as Comma Separated Values. Strings are enclosed by single quotes (&apos;). The first line contains a header. Each row contains, in that order, the original text, the text encoded as UTF-8 as hexadecimal octets, the angle in degrees, the calculated hue in degrees (differs from angle only for CVD-corrected rows), and the Red, Green, and Blue values.</p>
<section3 topic='No &cvd; correction' anchor='testvectors-fullrange-no-cvd'> <section3 topic='No &cvd; correction' anchor='testvectors-fullrange-no-cvd'>
<code><![CDATA[text,hextext,angle,hue,r,g,b <code><![CDATA[text,hextext,angle,hue,r,g,b
'Romeo','526f6d656f',237.255249,237.255249,0.000,0.498,0.698 'Romeo','526f6d656f',327.255249,327.255249,0.865,0.000,0.686
'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',119.410400,119.410400,0.254,0.529,0.000 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',209.410400,209.410400,0.000,0.515,0.573
'😺','f09f98ba',241.199341,241.199341,0.000,0.494,0.727 '😺','f09f98ba',331.199341,331.199341,0.872,0.000,0.659
'council','636f756e63696c',269.994507,269.994507,0.473,0.350,1.000 'council','636f756e63696c',359.994507,359.994507,0.918,0.000,0.394
'Board','426f617264',81.430664,81.430664,0.501,0.477,0.000]]></code> 'Board','426f617264',171.430664,171.430664,0.000,0.527,0.457]]></code>
</section3> </section3>
<section3 topic='With Red/Green-blindness correction' anchor='testvectors-fullrange-cvd-redgreen'> <section3 topic='With Red/Green-blindness correction' anchor='testvectors-fullrange-cvd-redgreen'>
<code><![CDATA[text,hextext,angle,hue,r,g,b <code><![CDATA[text,hextext,angle,hue,r,g,b
'Romeo','526f6d656f',237.255249,57.255249,0.596,0.442,0.000 'Romeo','526f6d656f',327.255249,327.255249,0.865,0.000,0.686
'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',119.410400,119.410400,0.254,0.529,0.000 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',209.410400,29.410400,0.742,0.359,0.000
'😺','f09f98ba',241.199341,61.199341,0.580,0.449,0.000 '😺','f09f98ba',331.199341,331.199341,0.872,0.000,0.659
'council','636f756e63696c',269.994507,89.994507,0.465,0.488,0.000 'council','636f756e63696c',359.994507,359.994507,0.918,0.000,0.394
'Board','426f617264',81.430664,81.430664,0.501,0.477,0.000]]></code> 'Board','426f617264',171.430664,351.430664,0.904,0.000,0.494]]></code>
</section3> </section3>
<section3 topic='With Blue-blindness correction' anchor='testvectors-fullrange-cvd-blue'> <section3 topic='With Blue-blindness correction' anchor='testvectors-fullrange-cvd-blue'>
<code><![CDATA[text,hextext,angle,hue,r,g,b <code><![CDATA[text,hextext,angle,hue,r,g,b
'Romeo','526f6d656f',237.255249,237.255249,0.000,0.498,0.698 'Romeo','526f6d656f',327.255249,147.255249,0.000,0.535,0.350
'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',119.410400,119.410400,0.254,0.529,0.000 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',209.410400,29.410400,0.742,0.359,0.000
'😺','f09f98ba',241.199341,241.199341,0.000,0.494,0.727 '😺','f09f98ba',331.199341,151.199341,0.000,0.533,0.373
'council','636f756e63696c',269.994507,269.994507,0.473,0.350,1.000 'council','636f756e63696c',359.994507,179.994507,0.000,0.524,0.485
'Board','426f617264',81.430664,261.430664,0.239,0.414,1.000]]></code> 'Board','426f617264',171.430664,171.430664,0.000,0.527,0.457]]></code>
</section3> </section3>
</section2> </section2>
<section2 topic='Test Vectors for mapping to 216 color palette' anchor='testvectors-palette'> <section2 topic='Test Vectors for mapping to 216 color palette' anchor='testvectors-palette'>
<p>The used palette can be generated by sampling the RGB cube evenly with six samples on each axis (resulting in 210 colors (grayscales are excluded)). The resulting palette is commonly known as the palette of so-called "Web Safe" colors.</p> <p>The used palette can be generated by sampling the RGB cube evenly with six samples on each axis (resulting in 210 colors (grayscales are excluded)). The resulting palette is commonly known as the palette of so-called "Web Safe" colors.</p>
<section3 topic='No &cvd; correction' anchor='testvectors-palette-no-cvd'> <section3 topic='No &cvd; correction' anchor='testvectors-palette-no-cvd'>
<code><![CDATA[text,hextext,hue,best_hue,r,g,b <code><![CDATA[text,hextext,hue,best_hue,r,g,b
'Romeo','526f6d656f',204.510498,192,0.000,0.800,0.800 'Romeo','526f6d656f',327.255249,327,1.000,0.000,0.800
'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',328.820801,328,1.000,0.200,0.800 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',209.410400,226,0.000,0.800,1.000
'😺','f09f98ba',212.398682,226,0.000,0.800,1.000 '😺','f09f98ba',331.199341,331,1.000,0.400,0.800
'council','636f756e63696c',269.989014,270,0.400,0.200,1.000 'council','636f756e63696c',359.994507,359,0.800,0.200,0.400
'Board','426f617264',252.861328,253,0.000,0.200,0.400]]></code> 'Board','426f617264',171.430664,161,0.000,1.000,0.800]]></code>
</section3> </section3>
<section3 topic='With Red/Green-blindness correction' anchor='testvectors-palette-cvd-redgreen'> <section3 topic='With Red/Green-blindness correction' anchor='testvectors-palette-cvd-redgreen'>
<code><![CDATA[text,hextext,hue,best_hue,r,g,b <code><![CDATA[text,hextext,hue,best_hue,r,g,b
'Romeo','526f6d656f',24.510498,26,0.800,0.400,0.200 'Romeo','526f6d656f',327.255249,327,1.000,0.000,0.800
'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',148.820801,148,0.000,0.600,0.400 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',29.410400,30,1.000,0.600,0.400
'😺','f09f98ba',32.398682,33,0.400,0.200,0.000 '😺','f09f98ba',331.199341,331,1.000,0.400,0.800
'council','636f756e63696c',89.989014,86,0.800,0.800,0.000 'council','636f756e63696c',359.994507,359,0.800,0.200,0.400
'Board','426f617264',72.861328,64,1.000,0.800,0.000]]></code> 'Board','426f617264',351.430664,353,0.400,0.000,0.200]]></code>
</section3> </section3>
<section3 topic='With Blue-blindness correction' anchor='testvectors-palette-cvd-blue'> <section3 topic='With Blue-blindness correction' anchor='testvectors-palette-cvd-blue'>
<code><![CDATA[text,hextext,hue,best_hue,r,g,b <code><![CDATA[text,hextext,hue,best_hue,r,g,b
'Romeo','526f6d656f',204.510498,192,0.000,0.800,0.800 'Romeo','526f6d656f',147.255249,147,0.400,0.800,0.600
'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',148.820801,148,0.000,0.600,0.400 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',29.410400,30,1.000,0.600,0.400
'😺','f09f98ba',212.398682,226,0.000,0.800,1.000 '😺','f09f98ba',151.199341,153,0.200,0.800,0.600
'council','636f756e63696c',269.989014,270,0.400,0.200,1.000 'council','636f756e63696c',179.994507,192,0.000,0.800,0.800
'Board','426f617264',252.861328,253,0.000,0.200,0.400]]></code> 'Board','426f617264',171.430664,161,0.000,1.000,0.800]]></code>
</section3> </section3>
</section2> </section2>
</section1> </section1>