No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0392.xml 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. <!ENTITY rgblind "<em>Red/Green-Blindness</em>">
  6. <!ENTITY bblind "<em>Blue-Blindness</em>">
  7. <!ENTITY cvd "Color Vision Deficiency">
  8. <!ENTITY cvds "Color Vision Deficiencies">
  9. ]>
  10. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  11. <xep>
  12. <header>
  13. <title>Consistent Color Generation</title>
  14. <abstract>This specification provides a set of algorithms to consistently generate colors given a string. The string can be a nickname, a JID or any other piece of information. All entities adhering to this specification generate the same color for the same string, which provides a consistent user experience across platforms.</abstract>
  15. &LEGALNOTICE;
  16. <number>0392</number>
  17. <status>Experimental</status>
  18. <type>Standards Track</type>
  19. <sig>Standards</sig>
  20. <approver>Council</approver>
  21. <dependencies></dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>colors</shortname>
  25. &jonaswielicki;
  26. <revision>
  27. <version>0.4</version>
  28. <date>2017-11-29</date>
  29. <initials>jwi</initials>
  30. <remark>
  31. <p>Use different formulas for Color Vision Deficiency correction, as suggested by Marcus Waldvogel.</p>
  32. <p>Update test vectors.</p>
  33. <p>Clarify generation of the angle.</p>
  34. <p>Prioritize nicknames over bare JIDs.</p>
  35. <p>Add rationale for new palette mapping algorithm introduced in 0.3.</p>
  36. </remark>
  37. </revision>
  38. <revision>
  39. <version>0.3</version>
  40. <date>2017-11-13</date>
  41. <initials>jwi</initials>
  42. <remark><p>
  43. Fix wording in angle generation section which did still use CRC32.
  44. Rework palette mapping after with implementation experience.
  45. </p></remark>
  46. </revision>
  47. <revision>
  48. <version>0.2</version>
  49. <date>2017-10-04</date>
  50. <initials>jwi</initials>
  51. <remark><p>
  52. Move to SHA-1 as mixing function;
  53. Properly reference BT.601 and include constants in text;
  54. Prefer bare JID over roster name when selecting the hash function input;
  55. Editing.
  56. </p></remark>
  57. </revision>
  58. <revision>
  59. <version>0.1</version>
  60. <date>2017-09-27</date>
  61. <initials>XEP Editor: jwi</initials>
  62. <remark><p>Accepted as Experimental by Council.</p></remark>
  63. </revision>
  64. <revision>
  65. <version>0.0.1</version>
  66. <date>2017-09-14</date>
  67. <initials>jwi</initials>
  68. <remark><p>First draft.</p></remark>
  69. </revision>
  70. </header>
  71. <section1 topic='Introduction' anchor='intro'>
  72. <p>Colors provide a valuable visual cue to recognize shapes. Recognition of colors works much faster than recognition of text. Together with the length and overall shape of a piece of text (such as a nickname), a color provides a decent amount of entropy to distinguish a reasonable amount of entities, without having to actually read the text.</p>
  73. <p>Clients have been using randomly or deterministically chosen colors for users in multi-user situations for a long time already. However, since there has been no standard for how this is implemented, the experience differs across platforms. The goal of this XEP is to provide a uniform, platform-independent, stateless and easy-to-implement way to map arbitrary bytestrings to colors, as well as give recommendations how this is applied to color names of participants in conversations, roster entries and other pieces of text.</p>
  74. <p>To allow cross-client use, it is important that the color scheme can be adapted to different environments. This specification provides means to adapt colors to different background colors as well as &cvds;.</p>
  75. <p>In no way is the system presented in this specification a replacement for names. It only serves as an additional visual aid.</p>
  76. </section1>
  77. <section1 topic='Requirements' anchor='reqs'>
  78. <p>The color generation mechanism should provide the following features:</p>
  79. <ul>
  80. <li>Consistent generation of color across all platforms depending solely on the identifier used as input for the algorithm.</li>
  81. <li>The system should be reasonably fast; it must be possible to, for example, apply it to all roster entries even of very large rosters in reasonable amount of time.</li>
  82. <li>It must be able to provide decent contrast on any background.</li>
  83. <li>The implementation should be stateless and not be complex.</li>
  84. <li>A fallback path for users with common types of &cvds; must be provided.</li>
  85. <li>A fallback path for systems which can only use colors from a restricted palette must be provided.</li>
  86. </ul>
  87. </section1>
  88. <section1 topic='Use Cases' anchor='usecases'>
  89. <section2 topic='Generating a color' anchor='usecase-textcolor'>
  90. <p>To generate a color from a string of text, the follownig algorithms are applied in order:</p>
  91. <ol>
  92. <li><link url='#algorithm-angle'>Generate an angle in the CbCr plane from the text</link>.</li>
  93. <li>If enabled, <link url='#algorithm-cvd'>apply configured corrections for &cvds;</link>.</li>
  94. <li>If the output device only supports a small palette of colors, <link url='#algorithm-mappalette'>map the angle to the closest palette color</link>.</li>
  95. <li>If the output device supports RGB output, <link url='#algorithm-cbcr'>Convert the angle to a CbCr pair</link> and <link url='#algorithm-rgb'>convert the CbCr pair to an RGB triple</link>.</li>
  96. </ol>
  97. </section2>
  98. <section2 topic='Adding colors to participants of a conversation' anchor='usecase-nickcolor'>
  99. <p>Implementations may colorize the participants of a conversation with an individual color to make them easier to distinguish.</p>
  100. <p>In such cases, the color SHOULD be generated as described in the <link url='#usecase-textcolor'>Generating a color</link> section. The input used SHOULD be, in descending order of preference, (a) the nickname from the conversation, (b) the bare JID.</p>
  101. </section2>
  102. <section2 topic='Auto-Generating Avatars' anchor='usecase-avatar'>
  103. <p>Implementations may want to show a picture in connection with a contact even if the contact does not have an avatar defined (e.g. via &xep0084;).</p>
  104. <p>In such cases, auto-generating an avatar SHOULD happen as follows:</p>
  105. <ol>
  106. <li>Obtain a name for the contact, in descending order of preference, (a) the nickname from the conversation, (b) the bare JID of the contact (<em>not</em> the bare JID of the conference in case of a &xep0045; room).</li>
  107. <li>Generate a color as described in the <link url='#usecase-textcolor'>Generating a color</link> section.</li>
  108. <li>Fill an implementation-defined background shape with that color.</li>
  109. <li>Render the first character of the name in white or black centered on the shape.</li>
  110. </ol>
  111. </section2>
  112. </section1>
  113. <section1 topic='Business Rules' anchor='rules'>
  114. <ul>
  115. <li>Implementations SHOULD allow the user to turn off any colorization completely.</li>
  116. <li>Implementations SHOULD implement the &cvd; profiles and SHOULD allow the user to choose any of these profiles or to disable the correction.</li>
  117. <li>Implementations MUST NOT share the &cvd; correction settings with other entities.</li>
  118. </ul>
  119. </section1>
  120. <section1 topic='Algorithms' anchor='algorithm'>
  121. <section2 topic='Angle generation' anchor='algorithm-angle'>
  122. <p>Input: An identifier, encoded as octets of UTF-8 (&rfc3269;).</p>
  123. <p>Output: Angle in the CbCr plane.</p>
  124. <p>Note: The goal of this algorithm is to convert arbitrary text into a scalar value which can then be used to calculate a color. As it happens, the CbCr plane of the YCbCr space determines the color (while Y merely defines the lightness); thus, an angle in the CbCr plane serves as a good scalar value to select a color.</p>
  125. <ol>
  126. <li>Run the input through SHA-1 (&rfc3174;).</li>
  127. <li>Treat the output as little endian and extract the last-significant 16 bits. (These are the first two bytes of the output, with the second byte being the most significant one.)</li>
  128. <li>Divide the value by 65536 (use float division) and multiply it by 2&#960; (two Pi).</li>
  129. </ol>
  130. </section2>
  131. <section2 topic='Corrections for &cvds;' anchor='algorithm-cvd'>
  132. <p>Input: Angle in the CbCr plane.</p>
  133. <p>Output: Angle in the CbCr plane.</p>
  134. <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>
  135. <section3 topic='Red/Green-blindness' anchor='algorithm-cvd-rg'>
  136. <p>Take the angle modulo &#960;.</p>
  137. <p>Note: the same effect can be achieved by forcing the most-significant bit of the angle to zero before converting to a float in <link url="#algorithm-angle">Angle generation</link>. This avoids having to perform a floating-point modulo operation.</p>
  138. </section3>
  139. <section3 topic='Blue-blindness' anchor='algorithm-cvd-b'>
  140. <p>Subtract &#960;/2 from the angle, take the result modulo &#960; and add &#960;/2.</p>
  141. <p>Note: the same effect can be achieved by setting the most-significant bit of the angle to the inverse of the second-most-significant bit before conversion to floating point in <link url="#algorithm-angle">Angle generation</link>. This avoids having to perform a floating-point modulo operation.</p>
  142. </section3>
  143. </section2>
  144. <section2 topic='CbCr generation' anchor='algorithm-cbcr'>
  145. <p>Input: Angle in the CbCr plane, from the previous algorithm.</p>
  146. <p>Output: Values for Cb and Cr in the YCbCr &BT.601; color space in the range from -0.5 to 0.5.</p>
  147. <p>Form a vector from the angle and project it to edges of a quad in 2D space with edge length 1 around (0, 0). The resulting coordinates are Cb and Cr:</p>
  148. <code><![CDATA[float cr = sin(angle);
  149. float cb = cos(angle);
  150. float factor;
  151. if (abs(cr) > abs(cb)) {
  152. factor = 0.5 / abs(cr);
  153. } else {
  154. factor = 0.5 / abs(cb);
  155. }
  156. cb = cb * factor;
  157. cr = cr * factor;
  158. ]]></code>
  159. </section2>
  160. <section2 topic='CbCr to RGB' anchor='algorithm-rgb'>
  161. <p>Input: Values for Cb and Cr in the YCbCr &BT.601; color space in the range from -0.5 to 0.5; Value for Y.</p>
  162. <p>Output: Values for Red (R), Green (G) and Blue (B) in the RGB color space in the range from 0 to 1.</p>
  163. <p>Note: The recommended value for Y is 0.732. See <link url='#impl-gamma'>Gamma Correction</link> for a discussion on the choice of Y.</p>
  164. <ol>
  165. <li>Calculate r, g and b according to BT.601:<code><![CDATA[float r = 2*(1 - KR)*cr + y;
  166. float b = 2*(1 - KB)*cb + y;
  167. float g = (y - KR*r - KB*b)/KG;
  168. ]]></code></li>
  169. <li>Clip the values of r, g and b to the range from 0 to 1.</li>
  170. </ol>
  171. <p>See <link url='#constants-ycbcr'>Constants for YCbCr (BT.601)</link> for the values of KR, KG and KB.</p>
  172. </section2>
  173. <section2 topic='Adapting the Color for specific Background Colors' anchor='algorithm-bg'>
  174. <p>Input: RGB values for the color to adapt (Ri, Gi, Bi) and for the background color to adapt to (Rb, Gb, Bb), in the range from 0 to 1 each.</p>
  175. <p>Output: Values for Red (Rc), Green (Gc) and Blue (Bc) in the RGB color space in the range from 0 to 1.</p>
  176. <ol>
  177. <li>Invert the background color by subtracting the individual channels from 1 each:
  178. <code><![CDATA[
  179. rb_inv = 1-rb;
  180. gb_inv = 1-gb;
  181. bb_inv = 1-bb;]]></code></li>
  182. <li>Mix the inverted background with the color to adapt, using a mixing factor of 0.2:
  183. <code><![CDATA[
  184. rc = 0.2*rb_inv + 0.8*ri;
  185. gc = 0.2*gb_inv + 0.8*gi;
  186. bc = 0.2*bb_inv + 0.8*bi;]]></code></li>
  187. </ol>
  188. </section2>
  189. <section2 topic='RGB to YCbCr' anchor='algorithm-rgb2cbcr'>
  190. <p>Input: Values for Red (R), Green (G) and Blue (B) in the RGB color space in the range from 0 to 1.</p>
  191. <p>Output: Values for Cb and Cr in the YCbCr &BT.601; color space in the range from -0.5 to 0.5; Value for Y.</p>
  192. <p>Calculate Y, Cb and Cr according to BT.601:</p>
  193. <code><![CDATA[
  194. y = KR*r + (1 - KR - KB)*g + KB*b;
  195. cb = (b - y) / (1 - KB) / 2
  196. cr = (r - y) / (1 - KR) / 2
  197. ]]></code>
  198. <p>See <link url='#constants-ycbcr'>Constants for YCbCr (BT.601)</link> for the values of KR, KG and KB.</p>
  199. </section2>
  200. <section2 topic='Conversion of an RGB color palette to a CbCr color palette' anchor='algorithm-genpalette'>
  201. <p>Input: A set of RGB colors (each component from 0 to 1).</p>
  202. <p>Output: A mapping from angles (from 0 to 2&#960;) to RGB colors.</p>
  203. <p>Note: when the algorithm finishes, the mapping maps angles (rounded to two decimal places) to the R, G, B triples which come closest to the desired color and lightness.</p>
  204. <ol>
  205. <li>Create an empty mapping M which maps from pairs of CbCr values to quadruples of Y, R, G and B.</li>
  206. <li>For each color R, G, B from the input palette:
  207. <ol>
  208. <li>If the R, G and B values are equal, skip the color and continue with the next.</li>
  209. <li>Calculate Y, Cb and Cr from R, G, B as described in <link url='#algorithm-rgb2cbcr'>RGB to YCbCr</link>.</li>
  210. <li><p>Convert Cb and Cr to an angle:</p>
  211. <code><![CDATA[
  212. magn = sqrt(Cb**2 + Cr**2)
  213. if magn > 0:
  214. cr /= magn
  215. cb /= magn
  216. angle = atan2(cr, cb) % (2*pi)
  217. ]]></code>
  218. <p>Here, % is the floating point modulo operator. Since atan2 may return negative values, it is used to put the values into the range from 0 to 2&#960;. ** is the exponentiation operator (cb**2 is thus cb squared).</p>
  219. </li>
  220. <li>Round the angle to two digits behind the decimal point.</li>
  221. <li>If the angle is not in the mapping M yet, or if the Y value of the existing entry is farther away from 0.732 than the new Y value, put the Y, R, G, and B values as value for the angle into the mapping.</li>
  222. </ol>
  223. </li>
  224. <li>Strip the Y values from the values of mapping M.</li>
  225. <li>Return M as the result of the algorithm.</li>
  226. </ol>
  227. <p>Implementations are free to choose a representation for palette colors different from R, G, B triplets. The exact representation does not matter, as long as it can be converted to an angle in the CbCr plane accordingly.</p>
  228. </section2>
  229. <section2 topic='Mapping of a CbCr color to closest palette color' anchor='algorithm-mappalette'>
  230. <p>Input: (a) A mapping which maps angles to R, G, B triplets and (b) a color to map to the closest palette color as angle alpha.</p>
  231. <p>Output: A palette color as R, G, B triplet.</p>
  232. <p>Note: See <link url='#algorithm-genpalette'>Conversion of an RGB color palette to a CbCr color palette</link> on how to convert an R, G, B triplet or a CbCr pair to an angle.</p>
  233. <ol>
  234. <li>First, check if alpha rounded to two places behind the decimal point has an exact match in the mapping. If so, return that match immediately.</li>
  235. <li>For each angle beta in the palette, calculate the distance metric: <code>D = min((alpha - beta) % (2*pi), (beta - alpha) % (2*pi))</code>.</li>
  236. <li>Return the R, G, B triplet associated with the angle with the smallest distance metric D.</li>
  237. </ol>
  238. <p>Implementations are free to choose a representation for palette colors different from R, G, B triplets. The exact representation does not matter, as long as it can be converted to an angle in the CbCr plane accordingly.</p>
  239. </section2>
  240. </section1>
  241. <section1 topic='Implementation Notes' anchor='impl'>
  242. <section2 topic='Gamma Correction' anchor='impl-gamma'>
  243. <p>An implementation may choose a different value for Y depending on whether the sink for the R, G and B values expects Gamma Encoded or Gamma Decoded values. The recommended default of 0.732 is 0.5 to the power of 0.45, that is, a Gamma Encoded 0.5.</p>
  244. <p>Modifications to Y SHOULD NOT be used to correct for bright/dark backgrounds. Implementations SHOULD instead use the algorithm described in <link url='#algorithm-bg'>Adapting the Color for specific Background Colors</link> for that.</p>
  245. </section2>
  246. <section2 topic='Background Color Correction' anchor='impl-bgcolor'>
  247. <p>An implementation which shows the generated colors on a colored background SHOULD apply <link url='#algorithm-bg'>Adapting the Color for specific Background Colors</link>. If the background is not uniformly colored, it is up to the implementation to determine an appropriate surrogate background color to correct against.</p>
  248. <p>If an implementation shows the generated colors on a grayscale (including white and black) background, it MAY apply the background color correction algorithm. It is RECOMMENDED to always apply the algorithm if the background color is changed dynamically, to avoid discontinuities between grayscale and colored backgrounds.</p>
  249. <p>Implementations SHOULD use the same background color for all generated colors. If this is not feasible, implementations SHOULD use the same background color for all generated colors within the same GUI control (for example, within a conversation and within the roster).</p>
  250. </section2>
  251. </section1>
  252. <section1 topic='Accessibility Considerations' anchor='access'>
  253. <p>As outlined above, implementations SHOULD offer the &rgblind; and &bblind; corrections as defined in the <link url='#algorithm-cvd'>Corrections for &cvds;</link> section. Users SHOULD be allowed to choose between:</p>
  254. <ul>
  255. <li>disabling all corrections (skip the Corrections for &cvds; step entirely),</li>
  256. <li>applying one of the &cvd; correction profiles and</li>
  257. <li>disabling colorization altogether.</li>
  258. </ul>
  259. <p>The last option is useful for users with monochromatic view or who find colors distracting.</p>
  260. <p>Some sources on the internet indicate that people with &cvds; may profit from having larger areas of color to be able to recognize them. This should be taken into consideration when selecting font weights and line widths for colored parts.</p>
  261. </section1>
  262. <section1 topic='Security Considerations' anchor='security'>
  263. <p>This specification extracts a bit more information from an entity and shows it alongside the existing information to the user. As the algorithm is likely to produce different colors for look-alikes (see &xep0165; for examples) in JIDs, it may add additional protection against attacks based on those.</p>
  264. <p>Due to the limited set of distinguishable colors and only extracting 16 bits of the hash function output, possible &cvds; and/or use of palettes, entities MUST NOT rely on colors being unique in any context.</p>
  265. </section1>
  266. <section1 topic='Design Considerations' anchor='design'>
  267. <p>This section provides an overview of design considerations made while writing this specification. It shows alternatives which have been considered, and eventually rejected.</p>
  268. <section2 topic='Other variants of the YCbCr color space' anchor='design-other-ycbcr'>
  269. <p>The other common YCbCr variants, BT.709 and BT.2020, do not achieve a brightness across the color space as uniform as &BT.601; does. Adapting the Y value for uniform luminosity across the range for CbCr would have complicated the algorithm with little or no gain.</p>
  270. </section2>
  271. <section2 topic='Hue-Saturation-Value/Lightness color space' anchor='design-hsv'>
  272. <p>The HSV and HSL color spaces fail to provide uniform luminosity with fixed value/lightness and saturation parameters. Adapting those parameters for uniform luminosity across the hue range would have complicated the algorithm with litte to no gain.</p>
  273. </section2>
  274. <section2 topic='Palette-based and context-aware coloring' anchor='design-context'>
  275. <p>Given a fixed-size and finite palette of colors, it would be possible to ensure that, until the number of entities to color exceeds the number of colors, no color collisions happen.</p>
  276. <p>There are issues with this approach when the set of entities is dynamic. In such cases, it is possible that an entity changes its associated color (for example by re-joining a colored group chat), which defeats the original purpose.</p>
  277. <p>In addition, more state needs to be taken into account, increasing the complexity of choosing a color.</p>
  278. </section2>
  279. <section2 topic='Choice of mixing function in angle generation' anchor='design-mixing'>
  280. <p>This specification needs to collapse an arbitrarily long string into just a few bits (the angle in the CbCr plane). To do so, SHA-1 (&rfc3174;) is used.</p>
  281. <p>CRC32 and Adler32 have been considered as faster alternatives. Downsides of these functions:</p>
  282. <ul>
  283. <li>Bad mixing without additional entropy.</li>
  284. <li>Adler32 is rarely available in standard libraries.</li>
  285. <li>CRC32 is ambiguous: there are multiple polynomials in widespread use (e.g. the Ethernet and the zlib polynomials). Often it is not clear which polynomial is used by a library.</li>
  286. </ul>
  287. <p>SHA-1 is widely available. From a security point of view, the exact choice of hash function does not matter here, since it is truncated to 16 bits. At this length, any cryptographic hash function is weak.</p>
  288. </section2>
  289. <section2 topic='Palette-mapping function' anchor='design-palette-mapping'>
  290. <p>The palette-mapping algorithm operates on angles only and disregards the Y value except if the angles match. This has the downside that the brightness is not equal over the range of the palette mapped colors.</p>
  291. <p>The alternative would be to require Y to be close to the target Y. This has several issues:</p>
  292. <ul>
  293. <li>We cannot know if a palette can satisfy the given Y at all.</li>
  294. <li>Many colors from e.g. the "Web Safe" palette (used in 256 color terminals and the test vectors) will not satisfy any given Y, reducing the size of the effective palette drastically.</li>
  295. </ul>
  296. <p>For the sake of having more colors available, the given algorithm was chosen which prefers many colors with hue conformance over fewer colors with hue and lightness conformance.</p>
  297. </section2>
  298. </section1>
  299. <section1 topic='IANA Considerations' anchor='iana'>
  300. <p>This document requires no interaction with &IANA;. </p>
  301. </section1>
  302. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  303. <p>This document requires no interaction with the &REGISTRAR;. </p>
  304. </section1>
  305. <section1 topic='Acknowledgements' anchor='acknowledgements'>
  306. <p>Thanks to Klaus Herberth, Daniel Gultsch, Georg Lukas, Tobias Markmann, Christian Schudt, and Marcus Waldvogel for their input and feedback on this document.</p>
  307. </section1>
  308. <section1 topic='Test Vectors and Constants' anchor='vectors-and-constants'>
  309. <section2 topic='Constants for YCbCr (BT.601)' anchor='constants-ycbcr'>
  310. <p>Throughout the document, the constants KR, KG and KB are used. They are defined in &BT.601; as:</p>
  311. <code><![CDATA[
  312. KR = 0.299
  313. KG = 0.587
  314. KB = 0.114
  315. ]]></code>
  316. </section2>
  317. <section2 topic='Test Vectors' anchor='testvectors-fullrange'>
  318. <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 radians, and the Cb, Cr, Red, Green, and Blue values.</p>
  319. <section3 topic='No &cvd; correction' anchor='testvectors-fullrange-no-cvd'>
  320. <code><![CDATA[text,hextext,angle,cb,cr,r,g,b
  321. 'Romeo','526f6d656f',5.711682,0.500000,-0.321546,0.281,0.790,1.000
  322. 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',3.654901,-0.500000,-0.281855,0.337,1.000,0.000
  323. '😺','f09f98ba',5.780519,0.500000,-0.274885,0.347,0.756,1.000
  324. 'council','636f756e63696c',6.283089,0.500000,-0.000048,0.732,0.560,1.000]]></code>
  325. </section3>
  326. <section3 topic='With Red/Green-blindness correction' anchor='testvectors-fullrange-cvd-redgreen'>
  327. <code><![CDATA[text,hextext,angle,cb,cr,r,g,b
  328. 'Romeo','526f6d656f',2.570089,-0.500000,0.321546,1.000,0.674,0.000
  329. 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',0.513308,0.500000,0.281855,1.000,0.359,1.000
  330. '😺','f09f98ba',2.638926,-0.500000,0.274885,1.000,0.708,0.000
  331. 'council','636f756e63696c',3.141497,-0.500000,0.000048,0.732,0.904,0.000]]></code>
  332. </section3>
  333. <section3 topic='With Blue-blindness correction' anchor='testvectors-fullrange-cvd-blue'>
  334. <code><![CDATA[text,hextext,angle,cb,cr,r,g,b
  335. 'Romeo','526f6d656f',2.570089,-0.500000,0.321546,1.000,0.674,0.000
  336. 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',3.654901,-0.500000,-0.281855,0.337,1.000,0.000
  337. '😺','f09f98ba',2.638926,-0.500000,0.274885,1.000,0.708,0.000
  338. 'council','636f756e63696c',3.141497,-0.500000,0.000048,0.732,0.904,0.000]]></code>
  339. </section3>
  340. </section2>
  341. <section2 topic='Test Vectors for mapping to 216 color palette' anchor='testvectors-palette'>
  342. <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>
  343. <p>Instead of the cb and cr values, the test vectors contain the best_angle as found in the palette.</p>
  344. <section3 topic='No &cvd; correction' anchor='testvectors-palette-no-cvd'>
  345. <code><![CDATA[text,hextext,angle,best_angle,cb,cr,r,g,b
  346. 'Romeo','526f6d656f',5.711682,5.690000,0.000,0.400,1.000
  347. 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',3.654901,3.640000,0.400,1.000,0.000
  348. '😺','f09f98ba',5.780519,5.770000,0.400,0.600,1.000
  349. 'council','636f756e63696c',6.283089,0.040000,0.200,0.000,1.000]]></code>
  350. </section3>
  351. <section3 topic='With Red/Green-blindness correction' anchor='testvectors-palette-cvd-redgreen'>
  352. <code><![CDATA[text,hextext,angle,best_angle,cb,cr,r,g,b
  353. 'Romeo','526f6d656f',2.570089,2.550000,1.000,0.600,0.000
  354. 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',0.513308,0.500000,0.600,0.000,1.000
  355. '😺','f09f98ba',2.638926,2.630000,1.000,0.800,0.400
  356. 'council','636f756e63696c',3.141497,3.180000,0.800,1.000,0.000]]></code>
  357. </section3>
  358. <section3 topic='With Blue-blindness correction' anchor='testvectors-palette-cvd-blue'>
  359. <code><![CDATA[text,hextext,angle,best_angle,cb,cr,r,g,b
  360. 'Romeo','526f6d656f',2.570089,2.550000,1.000,0.600,0.000
  361. 'juliet@capulet.lit','6a756c69657440636170756c65742e6c6974',3.654901,3.640000,0.400,1.000,0.000
  362. '😺','f09f98ba',2.638926,2.630000,1.000,0.800,0.400
  363. 'council','636f756e63696c',3.141497,3.180000,0.800,1.000,0.000]]></code>
  364. </section3>
  365. </section2>
  366. </section1>
  367. </xep>