tables.py 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. # -*- coding: utf-8 -*-
  2. # Copyright (c) 2013, Michael Nooner
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions are met:
  7. # * Redistributions of source code must retain the above copyright
  8. # notice, this list of conditions and the following disclaimer.
  9. # * Redistributions in binary form must reproduce the above copyright
  10. # notice, this list of conditions and the following disclaimer in the
  11. # documentation and/or other materials provided with the distribution.
  12. # * Neither the name of the copyright holder nor the names of its
  13. # contributors may be used to endorse or promote products derived from
  14. # this software without specific prior written permission
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. # ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  20. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. """This module lists out all of the tables needed to create a QR code.
  27. If you are viewing this in the HTML documentation, I recommend reading the
  28. actual file instead. The formating for the tables is much more readable.
  29. """
  30. from __future__ import division, unicode_literals
  31. #: This defines the QR Code's 'mode' which sets what
  32. #: type of code it is along with its size.
  33. modes = {
  34. 'numeric': 1,
  35. 'alphanumeric': 2,
  36. 'binary': 4,
  37. 'kanji': 8,
  38. }
  39. #: This defines the amount of error correction. The dictionary
  40. #: allows the user to specify this in several ways.
  41. error_level = {'L': 'L', 'l': 'L', '7%': 'L', .7: 'L',
  42. 'M': 'M', 'm': 'M', '15%': 'M', .15: 'M',
  43. 'Q': 'Q', 'q': 'Q', '25%': 'Q', .25: 'Q',
  44. 'H': 'H', 'h': 'H', '30%': 'H', .30: 'H'}
  45. #: This is a dictionary holds how long the "data length" field is for
  46. #: each version and mode of the QR Code.
  47. data_length_field = {9: {1: 10, 2: 9, 4: 8, 8: 8},
  48. 26: {1: 12, 2: 11, 4: 16, 8: 10},
  49. 40: {1: 14, 2: 13, 4: 16, 8: 12}}
  50. #: QR Codes uses a unique ASCII-like table for the 'alphanumeric' mode.
  51. #: This is a dictionary representing that unique table, where the
  52. #: keys are the possible characters in the data and the values
  53. #: are the character's numeric representation.
  54. ascii_codes = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7,
  55. '8': 8, '9': 9, 'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14,
  56. 'F': 15, 'G': 16, 'H': 17, 'I': 18, 'J': 19, 'K': 20, 'L': 21,
  57. 'M': 22, 'N': 23, 'O': 24, 'P': 25, 'Q': 26, 'R': 27, 'S': 28,
  58. 'T': 29, 'U': 30, 'V': 31, 'W': 32, 'X': 33, 'Y': 34, 'Z': 35,
  59. ' ': 36, '$': 37, '%': 38, '*': 39, '+': 40, '-': 41, '.': 42,
  60. '/': 43, ':': 44}
  61. #: This array specifies the size of a QR Code in pixels. These numbers are
  62. #: defined in the standard. The indexes correspond to the QR Code's
  63. #: version number. This array was taken from:
  64. #:
  65. #: http://www.denso-wave.com/qrcode/vertable1-e.html
  66. version_size = [None, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57,
  67. 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
  68. 101, 105, 109, 113, 117, 121, 125, 129, 133, 137,
  69. 141, 145, 149, 153, 157, 161, 165, 169, 173, 177]
  70. #: This dictionary lists the data capacity for all possible QR Codes.
  71. #: This dictionary is organized where the first key corresponds to the
  72. #: QR Code version number. The next key corresponds to the error
  73. #: correction level, see error. The final key corresponds to
  74. #: the mode number, see modes. The zero mode number represents the
  75. #: possible "data bits." This table was taken from:
  76. #:
  77. #: http://www.denso-wave.com/qrcode/vertable1-e.html
  78. data_capacity = {
  79. 1: {
  80. "L": {0: 152, 1: 41, 2: 25, 4: 17, 8: 10, },
  81. "M": {0: 128, 1: 34, 2: 20, 4: 14, 8: 8, },
  82. "Q": {0: 104, 1: 27, 2: 16, 4: 11, 8: 7, },
  83. "H": {0: 72, 1: 17, 2: 10, 4: 7, 8: 4, }},
  84. 2: {
  85. "L": {0: 272, 1: 77, 2: 47, 4: 32, 8: 20, },
  86. "M": {0: 224, 1: 63, 2: 38, 4: 26, 8: 16, },
  87. "Q": {0: 176, 1: 48, 2: 29, 4: 20, 8: 12, },
  88. "H": {0: 128, 1: 34, 2: 20, 4: 14, 8: 8, }},
  89. 3: {
  90. "L": {0: 440, 1: 127, 2: 77, 4: 53, 8: 32, },
  91. "M": {0: 352, 1: 101, 2: 61, 4: 42, 8: 26, },
  92. "Q": {0: 272, 1: 77, 2: 47, 4: 32, 8: 20, },
  93. "H": {0: 208, 1: 58, 2: 35, 4: 24, 8: 15, }},
  94. 4: {
  95. "L": {0: 640, 1: 187, 2: 114, 4: 78, 8: 48, },
  96. "M": {0: 512, 1: 149, 2: 90, 4: 62, 8: 38, },
  97. "Q": {0: 384, 1: 111, 2: 67, 4: 46, 8: 28, },
  98. "H": {0: 288, 1: 82, 2: 50, 4: 34, 8: 21, }},
  99. 5: {
  100. "L": {0: 864, 1: 255, 2: 154, 4: 106, 8: 65, },
  101. "M": {0: 688, 1: 202, 2: 122, 4: 84, 8: 52, },
  102. "Q": {0: 496, 1: 144, 2: 87, 4: 60, 8: 37, },
  103. "H": {0: 368, 1: 106, 2: 64, 4: 44, 8: 27, }},
  104. 6: {
  105. "L": {0: 1088, 1: 322, 2: 195, 4: 134, 8: 82, },
  106. "M": {0: 864, 1: 255, 2: 154, 4: 106, 8: 65, },
  107. "Q": {0: 608, 1: 178, 2: 108, 4: 74, 8: 45, },
  108. "H": {0: 480, 1: 139, 2: 84, 4: 58, 8: 36, }},
  109. 7: {
  110. "L": {0: 1248, 1: 370, 2: 224, 4: 154, 8: 95, },
  111. "M": {0: 992, 1: 293, 2: 178, 4: 122, 8: 75, },
  112. "Q": {0: 704, 1: 207, 2: 125, 4: 86, 8: 53, },
  113. "H": {0: 528, 1: 154, 2: 93, 4: 64, 8: 39, }},
  114. 8: {
  115. "L": {0: 1552, 1: 461, 2: 279, 4: 192, 8: 118, },
  116. "M": {0: 1232, 1: 365, 2: 221, 4: 152, 8: 93, },
  117. "Q": {0: 880, 1: 259, 2: 157, 4: 108, 8: 66, },
  118. "H": {0: 688, 1: 202, 2: 122, 4: 84, 8: 52, }},
  119. 9: {
  120. "L": {0: 1856, 1: 552, 2: 335, 4: 230, 8: 141, },
  121. "M": {0: 1456, 1: 432, 2: 262, 4: 180, 8: 111, },
  122. "Q": {0: 1056, 1: 312, 2: 189, 4: 130, 8: 80, },
  123. "H": {0: 800, 1: 235, 2: 143, 4: 98, 8: 60, }},
  124. 10: {
  125. "L": {0: 2192, 1: 652, 2: 395, 4: 271, 8: 167, },
  126. "M": {0: 1728, 1: 513, 2: 311, 4: 213, 8: 131, },
  127. "Q": {0: 1232, 1: 364, 2: 221, 4: 151, 8: 93, },
  128. "H": {0: 976, 1: 288, 2: 174, 4: 119, 8: 74, }},
  129. 11: {
  130. "L": {0: 2592, 1: 772, 2: 468, 4: 321, 8: 198, },
  131. "M": {0: 2032, 1: 604, 2: 366, 4: 251, 8: 155, },
  132. "Q": {0: 1440, 1: 427, 2: 259, 4: 177, 8: 109, },
  133. "H": {0: 1120, 1: 331, 2: 200, 4: 137, 8: 85, }},
  134. 12: {
  135. "L": {0: 2960, 1: 883, 2: 535, 4: 367, 8: 226, },
  136. "M": {0: 2320, 1: 691, 2: 419, 4: 287, 8: 177, },
  137. "Q": {0: 1648, 1: 489, 2: 296, 4: 203, 8: 125, },
  138. "H": {0: 1264, 1: 374, 2: 227, 4: 155, 8: 96, }},
  139. 13: {
  140. "L": {0: 3424, 1: 1022, 2: 619, 4: 425, 8: 262, },
  141. "M": {0: 2672, 1: 796, 2: 483, 4: 331, 8: 204, },
  142. "Q": {0: 1952, 1: 580, 2: 352, 4: 241, 8: 149, },
  143. "H": {0: 1440, 1: 427, 2: 259, 4: 177, 8: 109, }},
  144. 14: {
  145. "L": {0: 3688, 1: 1101, 2: 667, 4: 458, 8: 282, },
  146. "M": {0: 2920, 1: 871, 2: 528, 4: 362, 8: 223, },
  147. "Q": {0: 2088, 1: 621, 2: 376, 4: 258, 8: 159, },
  148. "H": {0: 1576, 1: 468, 2: 283, 4: 194, 8: 120, }},
  149. 15: {
  150. "L": {0: 4184, 1: 1250, 2: 758, 4: 520, 8: 320, },
  151. "M": {0: 3320, 1: 991, 2: 600, 4: 412, 8: 254, },
  152. "Q": {0: 2360, 1: 703, 2: 426, 4: 292, 8: 180, },
  153. "H": {0: 1784, 1: 530, 2: 321, 4: 220, 8: 136, }},
  154. 16: {
  155. "L": {0: 4712, 1: 1408, 2: 854, 4: 586, 8: 361, },
  156. "M": {0: 3624, 1: 1082, 2: 656, 4: 450, 8: 277, },
  157. "Q": {0: 2600, 1: 775, 2: 470, 4: 322, 8: 198, },
  158. "H": {0: 2024, 1: 602, 2: 365, 4: 250, 8: 154, }},
  159. 17: {
  160. "L": {0: 5176, 1: 1548, 2: 938, 4: 644, 8: 397, },
  161. "M": {0: 4056, 1: 1212, 2: 734, 4: 504, 8: 310, },
  162. "Q": {0: 2936, 1: 876, 2: 531, 4: 364, 8: 224, },
  163. "H": {0: 2264, 1: 674, 2: 408, 4: 280, 8: 173, }},
  164. 18: {
  165. "L": {0: 5768, 1: 1725, 2: 1046, 4: 718, 8: 442, },
  166. "M": {0: 4504, 1: 1346, 2: 816, 4: 560, 8: 345, },
  167. "Q": {0: 3176, 1: 948, 2: 574, 4: 394, 8: 243, },
  168. "H": {0: 2504, 1: 746, 2: 452, 4: 310, 8: 191, }},
  169. 19: {
  170. "L": {0: 6360, 1: 1903, 2: 1153, 4: 792, 8: 488, },
  171. "M": {0: 5016, 1: 1500, 2: 909, 4: 624, 8: 384, },
  172. "Q": {0: 3560, 1: 1063, 2: 644, 4: 442, 8: 272, },
  173. "H": {0: 2728, 1: 813, 2: 493, 4: 338, 8: 208, }},
  174. 20: {
  175. "L": {0: 6888, 1: 2061, 2: 1249, 4: 858, 8: 528, },
  176. "M": {0: 5352, 1: 1600, 2: 970, 4: 666, 8: 410, },
  177. "Q": {0: 3880, 1: 1159, 2: 702, 4: 482, 8: 297, },
  178. "H": {0: 3080, 1: 919, 2: 557, 4: 382, 8: 235, }},
  179. 21: {
  180. "L": {0: 7456, 1: 2232, 2: 1352, 4: 929, 8: 572, },
  181. "M": {0: 5712, 1: 1708, 2: 1035, 4: 711, 8: 438, },
  182. "Q": {0: 4096, 1: 1224, 2: 742, 4: 509, 8: 314, },
  183. "H": {0: 3248, 1: 969, 2: 587, 4: 403, 8: 248, }},
  184. 22: {
  185. "L": {0: 8048, 1: 2409, 2: 1460, 4: 1003, 8: 618, },
  186. "M": {0: 6256, 1: 1872, 2: 1134, 4: 779, 8: 480, },
  187. "Q": {0: 4544, 1: 1358, 2: 823, 4: 565, 8: 348, },
  188. "H": {0: 3536, 1: 1056, 2: 640, 4: 439, 8: 270, }},
  189. 23: {
  190. "L": {0: 8752, 1: 2620, 2: 1588, 4: 1091, 8: 672, },
  191. "M": {0: 6880, 1: 2059, 2: 1248, 4: 857, 8: 528, },
  192. "Q": {0: 4912, 1: 1468, 2: 890, 4: 611, 8: 376, },
  193. "H": {0: 3712, 1: 1108, 2: 672, 4: 461, 8: 284, }},
  194. 24: {
  195. "L": {0: 9392, 1: 2812, 2: 1704, 4: 1171, 8: 721, },
  196. "M": {0: 7312, 1: 2188, 2: 1326, 4: 911, 8: 561, },
  197. "Q": {0: 5312, 1: 1588, 2: 963, 4: 661, 8: 407, },
  198. "H": {0: 4112, 1: 1228, 2: 744, 4: 511, 8: 315, }},
  199. 25: {
  200. "L": {0: 10208, 1: 3057, 2: 1853, 4: 1273, 8: 784, },
  201. "M": {0: 8000, 1: 2395, 2: 1451, 4: 997, 8: 614, },
  202. "Q": {0: 5744, 1: 1718, 2: 1041, 4: 715, 8: 440, },
  203. "H": {0: 4304, 1: 1286, 2: 779, 4: 535, 8: 330, }},
  204. 26: {
  205. "L": {0: 10960, 1: 3283, 2: 1990, 4: 1367, 8: 842, },
  206. "M": {0: 8496, 1: 2544, 2: 1542, 4: 1059, 8: 652, },
  207. "Q": {0: 6032, 1: 1804, 2: 1094, 4: 751, 8: 462, },
  208. "H": {0: 4768, 1: 1425, 2: 864, 4: 593, 8: 365, }},
  209. 27: {
  210. "L": {0: 11744, 1: 3514, 2: 2132, 4: 1465, 8: 902, },
  211. "M": {0: 9024, 1: 2701, 2: 1637, 4: 1125, 8: 692, },
  212. "Q": {0: 6464, 1: 1933, 2: 1172, 4: 805, 8: 496, },
  213. "H": {0: 5024, 1: 1501, 2: 910, 4: 625, 8: 385, }},
  214. 28: {
  215. "L": {0: 12248, 1: 3669, 2: 2223, 4: 1528, 8: 940, },
  216. "M": {0: 9544, 1: 2857, 2: 1732, 4: 1190, 8: 732, },
  217. "Q": {0: 6968, 1: 2085, 2: 1263, 4: 868, 8: 534, },
  218. "H": {0: 5288, 1: 1581, 2: 958, 4: 658, 8: 405, }},
  219. 29: {
  220. "L": {0: 13048, 1: 3909, 2: 2369, 4: 1628, 8: 1002, },
  221. "M": {0: 10136, 1: 3035, 2: 1839, 4: 1264, 8: 778, },
  222. "Q": {0: 7288, 1: 2181, 2: 1322, 4: 908, 8: 559, },
  223. "H": {0: 5608, 1: 1677, 2: 1016, 4: 698, 8: 430, }},
  224. 30: {
  225. "L": {0: 13880, 1: 4158, 2: 2520, 4: 1732, 8: 1066, },
  226. "M": {0: 10984, 1: 3289, 2: 1994, 4: 1370, 8: 843, },
  227. "Q": {0: 7880, 1: 2358, 2: 1429, 4: 982, 8: 604, },
  228. "H": {0: 5960, 1: 1782, 2: 1080, 4: 742, 8: 457, }},
  229. 31: {
  230. "L": {0: 14744, 1: 4417, 2: 2677, 4: 1840, 8: 1132, },
  231. "M": {0: 11640, 1: 3486, 2: 2113, 4: 1452, 8: 894, },
  232. "Q": {0: 8264, 1: 2473, 2: 1499, 4: 1030, 8: 634, },
  233. "H": {0: 6344, 1: 1897, 2: 1150, 4: 790, 8: 486, }},
  234. 32: {
  235. "L": {0: 15640, 1: 4686, 2: 2840, 4: 1952, 8: 1201, },
  236. "M": {0: 12328, 1: 3693, 2: 2238, 4: 1538, 8: 947, },
  237. "Q": {0: 8920, 1: 2670, 2: 1618, 4: 1112, 8: 684, },
  238. "H": {0: 6760, 1: 2022, 2: 1226, 4: 842, 8: 518, }},
  239. 33: {
  240. "L": {0: 16568, 1: 4965, 2: 3009, 4: 2068, 8: 1273, },
  241. "M": {0: 13048, 1: 3909, 2: 2369, 4: 1628, 8: 1002, },
  242. "Q": {0: 9368, 1: 2805, 2: 1700, 4: 1168, 8: 719, },
  243. "H": {0: 7208, 1: 2157, 2: 1307, 4: 898, 8: 553, }},
  244. 34: {
  245. "L": {0: 17528, 1: 5253, 2: 3183, 4: 2188, 8: 1347, },
  246. "M": {0: 13800, 1: 4134, 2: 2506, 4: 1722, 8: 1060, },
  247. "Q": {0: 9848, 1: 2949, 2: 1787, 4: 1228, 8: 756, },
  248. "H": {0: 7688, 1: 2301, 2: 1394, 4: 958, 8: 590, }},
  249. 35: {
  250. "L": {0: 18448, 1: 5529, 2: 3351, 4: 2303, 8: 1417, },
  251. "M": {0: 14496, 1: 4343, 2: 2632, 4: 1809, 8: 1113, },
  252. "Q": {0: 10288, 1: 3081, 2: 1867, 4: 1283, 8: 790, },
  253. "H": {0: 7888, 1: 2361, 2: 1431, 4: 983, 8: 605, }},
  254. 36: {
  255. "L": {0: 19472, 1: 5836, 2: 3537, 4: 2431, 8: 1496, },
  256. "M": {0: 15312, 1: 4588, 2: 2780, 4: 1911, 8: 1176, },
  257. "Q": {0: 10832, 1: 3244, 2: 1966, 4: 1351, 8: 832, },
  258. "H": {0: 8432, 1: 2524, 2: 1530, 4: 1051, 8: 647, }},
  259. 37: {
  260. "L": {0: 20528, 1: 6153, 2: 3729, 4: 2563, 8: 1577, },
  261. "M": {0: 15936, 1: 4775, 2: 2894, 4: 1989, 8: 1224, },
  262. "Q": {0: 11408, 1: 3417, 2: 2071, 4: 1423, 8: 876, },
  263. "H": {0: 8768, 1: 2625, 2: 1591, 4: 1093, 8: 673, }},
  264. 38: {
  265. "L": {0: 21616, 1: 6479, 2: 3927, 4: 2699, 8: 1661, },
  266. "M": {0: 16816, 1: 5039, 2: 3054, 4: 2099, 8: 1292, },
  267. "Q": {0: 12016, 1: 3599, 2: 2181, 4: 1499, 8: 923, },
  268. "H": {0: 9136, 1: 2735, 2: 1658, 4: 1139, 8: 701, }},
  269. 39: {
  270. "L": {0: 22496, 1: 6743, 2: 4087, 4: 2809, 8: 1729, },
  271. "M": {0: 17728, 1: 5313, 2: 3220, 4: 2213, 8: 1362, },
  272. "Q": {0: 12656, 1: 3791, 2: 2298, 4: 1579, 8: 972, },
  273. "H": {0: 9776, 1: 2927, 2: 1774, 4: 1219, 8: 750, }},
  274. 40: {
  275. "L": {0: 23648, 1: 7089, 2: 4296, 4: 2953, 8: 1817, },
  276. "M": {0: 18672, 1: 5596, 2: 3391, 4: 2331, 8: 1435, },
  277. "Q": {0: 13328, 1: 3993, 2: 2420, 4: 1663, 8: 1024, },
  278. "H": {0: 10208, 1: 3057, 2: 1852, 4: 1273, 8: 784, }}
  279. }
  280. #: This table defines the "Error Correction Code Words and Block Information."
  281. #: The table lists the number of error correction words that are required
  282. #: to be generated for each version and error correction level. The table
  283. #: is accessed by first using the version number as a key and then the
  284. #: error level. The array values correspond to these columns from the source
  285. #: table:
  286. #:
  287. #: +----------------------------+
  288. #: |0 | EC Code Words Per Block |
  289. #: +----------------------------+
  290. #: |1 | Block 1 Count |
  291. #: +----------------------------+
  292. #: |2 | Block 1 Data Code Words |
  293. #: +----------------------------+
  294. #: |3 | Block 2 Count |
  295. #: +----------------------------+
  296. #: |4 | Block 2 Data Code Words |
  297. #: +----------------------------+
  298. #:
  299. #: This table was taken from:
  300. #:
  301. #: http://www.thonky.com/qr-code-tutorial/error-correction-table/
  302. eccwbi = {
  303. 1: {
  304. 'L': [7, 1, 19, 0, 0, ],
  305. 'M': [10, 1, 16, 0, 0, ],
  306. 'Q': [13, 1, 13, 0, 0, ],
  307. 'H': [17, 1, 9, 0, 0, ],
  308. },
  309. 2: {
  310. 'L': [10, 1, 34, 0, 0, ],
  311. 'M': [16, 1, 28, 0, 0, ],
  312. 'Q': [22, 1, 22, 0, 0, ],
  313. 'H': [28, 1, 16, 0, 0, ],
  314. },
  315. 3: {
  316. 'L': [15, 1, 55, 0, 0, ],
  317. 'M': [26, 1, 44, 0, 0, ],
  318. 'Q': [18, 2, 17, 0, 0, ],
  319. 'H': [22, 2, 13, 0, 0, ],
  320. },
  321. 4: {
  322. 'L': [20, 1, 80, 0, 0, ],
  323. 'M': [18, 2, 32, 0, 0, ],
  324. 'Q': [26, 2, 24, 0, 0, ],
  325. 'H': [16, 4, 9, 0, 0, ],
  326. },
  327. 5: {
  328. 'L': [26, 1, 108, 0, 0, ],
  329. 'M': [24, 2, 43, 0, 0, ],
  330. 'Q': [18, 2, 15, 2, 16, ],
  331. 'H': [22, 2, 11, 2, 12, ],
  332. },
  333. 6: {
  334. 'L': [18, 2, 68, 0, 0, ],
  335. 'M': [16, 4, 27, 0, 0, ],
  336. 'Q': [24, 4, 19, 0, 0, ],
  337. 'H': [28, 4, 15, 0, 0, ],
  338. },
  339. 7: {
  340. 'L': [20, 2, 78, 0, 0, ],
  341. 'M': [18, 4, 31, 0, 0, ],
  342. 'Q': [18, 2, 14, 4, 15, ],
  343. 'H': [26, 4, 13, 1, 14, ],
  344. },
  345. 8: {
  346. 'L': [24, 2, 97, 0, 0, ],
  347. 'M': [22, 2, 38, 2, 39, ],
  348. 'Q': [22, 4, 18, 2, 19, ],
  349. 'H': [26, 4, 14, 2, 15, ],
  350. },
  351. 9: {
  352. 'L': [30, 2, 116, 0, 0, ],
  353. 'M': [22, 3, 36, 2, 37, ],
  354. 'Q': [20, 4, 16, 4, 17, ],
  355. 'H': [24, 4, 12, 4, 13, ],
  356. },
  357. 10: {
  358. 'L': [18, 2, 68, 2, 69, ],
  359. 'M': [26, 4, 43, 1, 44, ],
  360. 'Q': [24, 6, 19, 2, 20, ],
  361. 'H': [28, 6, 15, 2, 16, ],
  362. },
  363. 11: {
  364. 'L': [20, 4, 81, 0, 0, ],
  365. 'M': [30, 1, 50, 4, 51, ],
  366. 'Q': [28, 4, 22, 4, 23, ],
  367. 'H': [24, 3, 12, 8, 13, ],
  368. },
  369. 12: {
  370. 'L': [24, 2, 92, 2, 93, ],
  371. 'M': [22, 6, 36, 2, 37, ],
  372. 'Q': [26, 4, 20, 6, 21, ],
  373. 'H': [28, 7, 14, 4, 15, ],
  374. },
  375. 13: {
  376. 'L': [26, 4, 107, 0, 0, ],
  377. 'M': [22, 8, 37, 1, 38, ],
  378. 'Q': [24, 8, 20, 4, 21, ],
  379. 'H': [22, 12, 11, 4, 12, ],
  380. },
  381. 14: {
  382. 'L': [30, 3, 115, 1, 116, ],
  383. 'M': [24, 4, 40, 5, 41, ],
  384. 'Q': [20, 11, 16, 5, 17, ],
  385. 'H': [24, 11, 12, 5, 13, ],
  386. },
  387. 15: {
  388. 'L': [22, 5, 87, 1, 88, ],
  389. 'M': [24, 5, 41, 5, 42, ],
  390. 'Q': [30, 5, 24, 7, 25, ],
  391. 'H': [24, 11, 12, 7, 13, ],
  392. },
  393. 16: {
  394. 'L': [24, 5, 98, 1, 99, ],
  395. 'M': [28, 7, 45, 3, 46, ],
  396. 'Q': [24, 15, 19, 2, 20, ],
  397. 'H': [30, 3, 15, 13, 16, ],
  398. },
  399. 17: {
  400. 'L': [28, 1, 107, 5, 108, ],
  401. 'M': [28, 10, 46, 1, 47, ],
  402. 'Q': [28, 1, 22, 15, 23, ],
  403. 'H': [28, 2, 14, 17, 15, ],
  404. },
  405. 18: {
  406. 'L': [30, 5, 120, 1, 121, ],
  407. 'M': [26, 9, 43, 4, 44, ],
  408. 'Q': [28, 17, 22, 1, 23, ],
  409. 'H': [28, 2, 14, 19, 15, ],
  410. },
  411. 19: {
  412. 'L': [28, 3, 113, 4, 114, ],
  413. 'M': [26, 3, 44, 11, 45, ],
  414. 'Q': [26, 17, 21, 4, 22, ],
  415. 'H': [26, 9, 13, 16, 14, ],
  416. },
  417. 20: {
  418. 'L': [28, 3, 107, 5, 108, ],
  419. 'M': [26, 3, 41, 13, 42, ],
  420. 'Q': [30, 15, 24, 5, 25, ],
  421. 'H': [28, 15, 15, 10, 16, ],
  422. },
  423. 21: {
  424. 'L': [28, 4, 116, 4, 117, ],
  425. 'M': [26, 17, 42, 0, 0, ],
  426. 'Q': [28, 17, 22, 6, 23, ],
  427. 'H': [30, 19, 16, 6, 17, ],
  428. },
  429. 22: {
  430. 'L': [28, 2, 111, 7, 112, ],
  431. 'M': [28, 17, 46, 0, 0, ],
  432. 'Q': [30, 7, 24, 16, 25, ],
  433. 'H': [24, 34, 13, 0, 0, ],
  434. },
  435. 23: {
  436. 'L': [30, 4, 121, 5, 122, ],
  437. 'M': [28, 4, 47, 14, 48, ],
  438. 'Q': [30, 11, 24, 14, 25, ],
  439. 'H': [30, 16, 15, 14, 16, ],
  440. },
  441. 24: {
  442. 'L': [30, 6, 117, 4, 118, ],
  443. 'M': [28, 6, 45, 14, 46, ],
  444. 'Q': [30, 11, 24, 16, 25, ],
  445. 'H': [30, 30, 16, 2, 17, ],
  446. },
  447. 25: {
  448. 'L': [26, 8, 106, 4, 107, ],
  449. 'M': [28, 8, 47, 13, 48, ],
  450. 'Q': [30, 7, 24, 22, 25, ],
  451. 'H': [30, 22, 15, 13, 16, ],
  452. },
  453. 26: {
  454. 'L': [28, 10, 114, 2, 115, ],
  455. 'M': [28, 19, 46, 4, 47, ],
  456. 'Q': [28, 28, 22, 6, 23, ],
  457. 'H': [30, 33, 16, 4, 17, ],
  458. },
  459. 27: {
  460. 'L': [30, 8, 122, 4, 123, ],
  461. 'M': [28, 22, 45, 3, 46, ],
  462. 'Q': [30, 8, 23, 26, 24, ],
  463. 'H': [30, 12, 15, 28, 16, ],
  464. },
  465. 28: {
  466. 'L': [30, 3, 117, 10, 118, ],
  467. 'M': [28, 3, 45, 23, 46, ],
  468. 'Q': [30, 4, 24, 31, 25, ],
  469. 'H': [30, 11, 15, 31, 16, ],
  470. },
  471. 29: {
  472. 'L': [30, 7, 116, 7, 117, ],
  473. 'M': [28, 21, 45, 7, 46, ],
  474. 'Q': [30, 1, 23, 37, 24, ],
  475. 'H': [30, 19, 15, 26, 16, ],
  476. },
  477. 30: {
  478. 'L': [30, 5, 115, 10, 116, ],
  479. 'M': [28, 19, 47, 10, 48, ],
  480. 'Q': [30, 15, 24, 25, 25, ],
  481. 'H': [30, 23, 15, 25, 16, ],
  482. },
  483. 31: {
  484. 'L': [30, 13, 115, 3, 116, ],
  485. 'M': [28, 2, 46, 29, 47, ],
  486. 'Q': [30, 42, 24, 1, 25, ],
  487. 'H': [30, 23, 15, 28, 16, ],
  488. },
  489. 32: {
  490. 'L': [30, 17, 115, 0, 0, ],
  491. 'M': [28, 10, 46, 23, 47, ],
  492. 'Q': [30, 10, 24, 35, 25, ],
  493. 'H': [30, 19, 15, 35, 16, ],
  494. },
  495. 33: {
  496. 'L': [30, 17, 115, 1, 116, ],
  497. 'M': [28, 14, 46, 21, 47, ],
  498. 'Q': [30, 29, 24, 19, 25, ],
  499. 'H': [30, 11, 15, 46, 16, ],
  500. },
  501. 34: {
  502. 'L': [30, 13, 115, 6, 116, ],
  503. 'M': [28, 14, 46, 23, 47, ],
  504. 'Q': [30, 44, 24, 7, 25, ],
  505. 'H': [30, 59, 16, 1, 17, ],
  506. },
  507. 35: {
  508. 'L': [30, 12, 121, 7, 122, ],
  509. 'M': [28, 12, 47, 26, 48, ],
  510. 'Q': [30, 39, 24, 14, 25, ],
  511. 'H': [30, 22, 15, 41, 16, ],
  512. },
  513. 36: {
  514. 'L': [30, 6, 121, 14, 122, ],
  515. 'M': [28, 6, 47, 34, 48, ],
  516. 'Q': [30, 46, 24, 10, 25, ],
  517. 'H': [30, 2, 15, 64, 16, ],
  518. },
  519. 37: {
  520. 'L': [30, 17, 122, 4, 123, ],
  521. 'M': [28, 29, 46, 14, 47, ],
  522. 'Q': [30, 49, 24, 10, 25, ],
  523. 'H': [30, 24, 15, 46, 16, ],
  524. },
  525. 38: {
  526. 'L': [30, 4, 122, 18, 123, ],
  527. 'M': [28, 13, 46, 32, 47, ],
  528. 'Q': [30, 48, 24, 14, 25, ],
  529. 'H': [30, 42, 15, 32, 16, ],
  530. },
  531. 39: {
  532. 'L': [30, 20, 117, 4, 118, ],
  533. 'M': [28, 40, 47, 7, 48, ],
  534. 'Q': [30, 43, 24, 22, 25, ],
  535. 'H': [30, 10, 15, 67, 16, ],
  536. },
  537. 40: {
  538. 'L': [30, 19, 118, 6, 119, ],
  539. 'M': [28, 18, 47, 31, 48, ],
  540. 'Q': [30, 34, 24, 34, 25, ],
  541. 'H': [30, 20, 15, 61, 16, ],
  542. },
  543. }
  544. #: This table lists all of the generator polynomials used by QR Codes.
  545. #: They are indexed by the number of "ECC Code Words" (see table above).
  546. #: This table is taken from:
  547. #:
  548. #: http://www.matchadesign.com/blog/qr-code-demystified-part-4/
  549. generator_polynomials = {
  550. 7: [87, 229, 146, 149, 238, 102, 21],
  551. 10: [251, 67, 46, 61, 118, 70, 64, 94, 32, 45],
  552. 13: [74, 152, 176, 100, 86, 100, 106, 104, 130, 218, 206, 140, 78],
  553. 15: [8, 183, 61, 91, 202, 37, 51, 58, 58, 237, 140, 124, 5, 99, 105],
  554. 16: [120, 104, 107, 109, 102, 161, 76, 3, 91, 191, 147, 169, 182, 194,
  555. 225, 120],
  556. 17: [43, 139, 206, 78, 43, 239, 123, 206, 214, 147, 24, 99, 150, 39,
  557. 243, 163, 136],
  558. 18: [215, 234, 158, 94, 184, 97, 118, 170, 79, 187, 152, 148, 252, 179,
  559. 5, 98, 96, 153],
  560. 20: [17, 60, 79, 50, 61, 163, 26, 187, 202, 180, 221, 225, 83, 239, 156,
  561. 164, 212, 212, 188, 190],
  562. 22: [210, 171, 247, 242, 93, 230, 14, 109, 221, 53, 200, 74, 8, 172, 98,
  563. 80, 219, 134, 160, 105, 165, 231],
  564. 24: [229, 121, 135, 48, 211, 117, 251, 126, 159, 180, 169, 152, 192, 226,
  565. 228, 218, 111, 0, 117, 232, 87, 96, 227, 21],
  566. 26: [173, 125, 158, 2, 103, 182, 118, 17, 145, 201, 111, 28, 165, 53, 161,
  567. 21, 245, 142, 13, 102, 48, 227, 153, 145, 218, 70],
  568. 28: [168, 223, 200, 104, 224, 234, 108, 180, 110, 190, 195, 147, 205, 27,
  569. 232, 201, 21, 43, 245, 87, 42, 195, 212, 119, 242, 37, 9, 123],
  570. 30: [41, 173, 145, 152, 216, 31, 179, 182, 50, 48, 110, 86, 239, 96, 222,
  571. 125, 42, 173, 226, 193, 224, 130, 156, 37, 251, 216, 238, 40, 192,
  572. 180]
  573. }
  574. #: This table contains the log and values used in GF(256) arithmetic.
  575. #: They are used to generate error correction codes for QR Codes.
  576. #: This table is taken from:
  577. #:
  578. #: vhttp://www.thonky.com/qr-code-tutorial/log-antilog-table/
  579. galois_log = [
  580. 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152,
  581. 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78,
  582. 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, 70, 140, 5,
  583. 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, 95, 190, 97,
  584. 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211,
  585. 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217, 175,
  586. 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, 129, 31,
  587. 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, 133,
  588. 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, 168, 77,
  589. 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209,
  590. 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227,
  591. 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, 130,
  592. 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, 81,
  593. 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, 18,
  594. 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, 44,
  595. 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1,]
  596. #: This table contains the antilog and values used in GF(256) arithmetic.
  597. #: They are used to generate error correction codes for QR Codes.
  598. #: This table is taken from:
  599. #:
  600. #: http://www.thonky.com/qr-code-tutorial/log-antilog-table/
  601. galois_antilog = [
  602. None, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100,
  603. 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138,
  604. 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, 29, 181,
  605. 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, 6, 191,
  606. 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, 54, 208,
  607. 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66,
  608. 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94,
  609. 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, 7, 112,
  610. 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, 227, 165,
  611. 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, 55, 63,
  612. 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242,
  613. 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31, 45,
  614. 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, 108,
  615. 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, 203,
  616. 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, 79,
  617. 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175,]
  618. #: This table contains the coordinates for the position adjustment patterns.
  619. #: The index of the table corresponds to the QR Code's version number.
  620. #: This table is taken from:
  621. #:
  622. #: http://www.thonky.com/qr-code-tutorial/part-3-mask-pattern/
  623. position_adjustment = [
  624. None, #There is not version 0
  625. None, #Version 1 does not need adjustment
  626. [6, 18, ],
  627. [6, 22, ],
  628. [6, 26, ],
  629. [6, 30, ],
  630. [6, 34, ],
  631. [6, 22, 38, ],
  632. [6, 24, 42, ],
  633. [6, 26, 46, ],
  634. [6, 28, 50, ],
  635. [6, 30, 54, ],
  636. [6, 32, 58, ],
  637. [6, 34, 62, ],
  638. [6, 26, 46, 66, ],
  639. [6, 26, 48, 70, ],
  640. [6, 26, 50, 74, ],
  641. [6, 30, 54, 78, ],
  642. [6, 30, 56, 82, ],
  643. [6, 30, 58, 86, ],
  644. [6, 34, 62, 90, ],
  645. [6, 28, 50, 72, 94, ],
  646. [6, 26, 50, 74, 98, ],
  647. [6, 30, 54, 78, 102, ],
  648. [6, 28, 54, 80, 106, ],
  649. [6, 32, 58, 84, 110, ],
  650. [6, 30, 58, 86, 114, ],
  651. [6, 34, 62, 90, 118, ],
  652. [6, 26, 50, 74, 98, 122, ],
  653. [6, 30, 54, 78, 102, 126, ],
  654. [6, 26, 52, 78, 104, 130, ],
  655. [6, 30, 56, 82, 108, 134, ],
  656. [6, 34, 60, 86, 112, 138, ],
  657. [6, 30, 58, 86, 114, 142, ],
  658. [6, 34, 62, 90, 118, 146, ],
  659. [6, 30, 54, 78, 102, 126, 150, ],
  660. [6, 24, 50, 76, 102, 128, 154, ],
  661. [6, 28, 54, 80, 106, 132, 158, ],
  662. [6, 32, 58, 84, 110, 136, 162, ],
  663. [6, 26, 54, 82, 110, 138, 166, ],
  664. [6, 30, 58, 86, 114, 142, 170, ],
  665. ]
  666. #: This table specifies the bit pattern to be added to a QR Code's
  667. #: image to specify what version the code is. Note, this pattern
  668. #: is not used for versions 1-6. This table is taken from:
  669. #:
  670. #: http://www.thonky.com/qr-code-tutorial/part-3-mask-pattern/
  671. version_pattern = [None, None, None, None, None, None, None, #0-6
  672. '000111110010010100', '001000010110111100', '001001101010011001',
  673. '001010010011010011', '001011101111110110', '001100011101100010',
  674. '001101100001000111', '001110011000001101', '001111100100101000',
  675. '010000101101111000', '010001010001011101', '010010101000010111',
  676. '010011010100110010', '010100100110100110', '010101011010000011',
  677. '010110100011001001', '010111011111101100', '011000111011000100',
  678. '011001000111100001', '011010111110101011', '011011000010001110',
  679. '011100110000011010', '011101001100111111', '011110110101110101',
  680. '011111001001010000', '100000100111010101', '100001011011110000',
  681. '100010100010111010', '100011011110011111', '100100101100001011',
  682. '100101010000101110', '100110101001100100', '100111010101000001',
  683. '101000110001101001'
  684. ]
  685. #: This table contains the bit fields needed to specify the error code level and
  686. #: mask pattern used by a QR Code. This table is take from:
  687. #:
  688. #: http://www.thonky.com/qr-code-tutorial/part-3-mask-pattern/
  689. type_bits = {
  690. 'L': {
  691. 0: '111011111000100',
  692. 1: '111001011110011',
  693. 2: '111110110101010',
  694. 3: '111100010011101',
  695. 4: '110011000101111',
  696. 5: '110001100011000',
  697. 6: '110110001000001',
  698. 7: '110100101110110',
  699. },
  700. 'M': {
  701. 0: '101010000010010',
  702. 1: '101000100100101',
  703. 2: '101111001111100',
  704. 3: '101101101001011',
  705. 4: '100010111111001',
  706. 5: '100000011001110',
  707. 6: '100111110010111',
  708. 7: '100101010100000',
  709. },
  710. 'Q': {
  711. 0: '011010101011111',
  712. 1: '011000001101000',
  713. 2: '011111100110001',
  714. 3: '011101000000110',
  715. 4: '010010010110100',
  716. 5: '010000110000011',
  717. 6: '010111011011010',
  718. 7: '010101111101101',
  719. },
  720. 'H': {
  721. 0: '001011010001001',
  722. 1: '001001110111110',
  723. 2: '001110011100111',
  724. 3: '001100111010000',
  725. 4: '000011101100010',
  726. 5: '000001001010101',
  727. 6: '000110100001100',
  728. 7: '000100000111011',
  729. },
  730. }
  731. #: This table contains *functions* to compute whether to change current bit when
  732. #: creating the masks. All of the functions in the table return a boolean value.
  733. #: A True result means you should add the bit to the QR Code exactly as is. A
  734. #: False result means you should add the opposite bit. This table was taken
  735. #: from:
  736. #:
  737. #: http://www.thonky.com/qr-code-tutorial/mask-patterns/
  738. mask_patterns = [
  739. lambda row, col: (row + col) % 2 == 0,
  740. lambda row, col: row % 2 == 0,
  741. lambda row, col: col % 3 == 0,
  742. lambda row, col: (row + col) % 3 == 0,
  743. lambda row, col: ((row // 2) + (col // 3)) % 2 == 0,
  744. lambda row, col: ((row * col) % 2) + ((row * col) % 3) == 0,
  745. lambda row, col: (((row * col) % 2) + ((row * col) % 3)) % 2 == 0,
  746. lambda row, col: (((row + col) % 2) + ((row * col) % 3)) % 2 == 0]
  747. #: This is a table of ASCII escape code for terminal colors. QR codes
  748. #: are drawn using a space with a colored background. Hence, only
  749. #: codes affecting background colors have been added.
  750. #: http://misc.flogisoft.com/bash/tip_colors_and_formatting
  751. term_colors = {
  752. 'default': 49,
  753. 'background': 49,
  754. 'reverse': 7,
  755. 'reversed': 7,
  756. 'inverse': 7,
  757. 'inverted': 7,
  758. 'black': 40,
  759. 'red': 41,
  760. 'green': 42,
  761. 'yellow': 43,
  762. 'blue': 44,
  763. 'magenta': 45,
  764. 'cyan': 46,
  765. 'light gray': 47,
  766. 'light grey': 47,
  767. 'dark gray': 100,
  768. 'dark grey': 100,
  769. 'light red': 101,
  770. 'light green': 102,
  771. 'light blue': 103,
  772. 'light yellow': 104,
  773. 'light magenta': 105,
  774. 'light cyan': 106,
  775. 'white': 107
  776. }