Colour conversion between RGB and Blender colours

Just thought I would make a table so I can look up conversions faster than using the calculator all the time.

If its useful to anyone else, feel free to use it.

I have an eventual dream than typing in a number greater than 1 in blender, i.e 188, will automatically convert it into a number between 0 and 1

Note: you can use the Find function (Ctrl+F) on your browser to look up numbers in the table quickly


 RGB value   Blender Value
  0          0.000
  1          0.004
  2          0.008
  3          0.012
  4          0.016
  5          0.020
  6          0.024
  7          0.027
  8          0.031
  9          0.035
  10          0.039
  11          0.043
  12          0.047
  13          0.051
  14          0.055
  15          0.059
  16          0.063
  17          0.067
  18          0.071
  19          0.075
  20          0.078
  21          0.082
  22          0.086
  23          0.090
  24          0.094
  25          0.098
  26          0.102
  27          0.106
  28          0.110
  29          0.114
  30          0.118
  31          0.122
  32          0.125
  33          0.129
  34          0.133
  35          0.137
  36          0.141
  37          0.145
  38          0.149
  39          0.153
  40          0.157
  41          0.161
  42          0.165
  43          0.169
  44          0.173
  45          0.176
  46          0.180
  47          0.184
  48          0.188
  49          0.192
  50          0.196
  51          0.200
  52          0.204
  53          0.208
  54          0.212
  55          0.216
  56          0.220
  57          0.224
  58          0.227
  59          0.231
  60          0.235
  61          0.239
  62          0.243
  63          0.247
  64          0.251
  65          0.255
  66          0.259
  67          0.263
  68          0.267
  69          0.271
  70          0.275
  71          0.278
  72          0.282
  73          0.286
  74          0.290
  75          0.294
  76          0.298
  77          0.302
  78          0.306
  79          0.310
  80          0.314
  81          0.318
  82          0.322
  83          0.325
  84          0.329
  85          0.333
  86          0.337
  87          0.341
  88          0.345
  89          0.349
  90          0.353
  91          0.357
  92          0.361
  93          0.365
  94          0.369
  95          0.373
  96          0.376
  97          0.380
  98          0.384
  99          0.388
  100          0.392
  101          0.396
  102          0.400
  103          0.404
  104          0.408
  105          0.412
  106          0.416
  107          0.420
  108          0.424
  109          0.427
  110          0.431
  111          0.435
  112          0.439
  113          0.443
  114          0.447
  115          0.451
  116          0.455
  117          0.459
  118          0.463
  119          0.467
  120          0.471
  121          0.475
  122          0.478
  123          0.482
  124          0.486
  125          0.490
  126          0.494
  127          0.498
  128          0.502
  129          0.506
  130          0.510
  131          0.514
  132          0.518
  133          0.522
  134          0.525
  135          0.529
  136          0.533
  137          0.537
  138          0.541
  139          0.545
  140          0.549
  141          0.553
  142          0.557
  143          0.561
  144          0.565
  145          0.569
  146          0.573
  147          0.576
  148          0.580
  149          0.584
  150          0.588
  151          0.592
  152          0.596
  153          0.600
  154          0.604
  155          0.608
  156          0.612
  157          0.616
  158          0.620
  159          0.624
  160          0.627
  161          0.631
  162          0.635
  163          0.639
  164          0.643
  165          0.647
  166          0.651
  167          0.655
  168          0.659
  169          0.663
  170          0.667
  171          0.671
  172          0.675
  173          0.678
  174          0.682
  175          0.686
  176          0.690
  177          0.694
  178          0.698
  179          0.702
  180          0.706
  181          0.710
  182          0.714
  183          0.718
  184          0.722
  185          0.725
  186          0.729
  187          0.733
  188          0.737
  189          0.741
  190          0.745
  191          0.749
  192          0.753
  193          0.757
  194          0.761
  195          0.765
  196          0.769
  197          0.773
  198          0.776
  199          0.780
  200          0.784
  201          0.788
  202          0.792
  203          0.796
  204          0.800
  205          0.804
  206          0.808
  207          0.812
  208          0.816
  209          0.820
  210          0.824
  211          0.827
  212          0.831
  213          0.835
  214          0.839
  215          0.843
  216          0.847
  217          0.851
  218          0.855
  219          0.859
  220          0.863
  221          0.867
  222          0.871
  223          0.875
  224          0.878
  225          0.882
  226          0.886
  227          0.890
  228          0.894
  229          0.898
  230          0.902
  231          0.906
  232          0.910
  233          0.914
  234          0.918
  235          0.922
  236          0.925
  237          0.929
  238          0.933
  239          0.937
  240          0.941
  241          0.945
  242          0.949
  243          0.953
  244          0.957
  245          0.961
  246          0.965
  247          0.969
  248          0.973
  249          0.976
  250          0.980
  251          0.984
  252          0.988
  253          0.992
  254          0.996
  255          1.000
  

You are aware that Blender fields accept calculations? This is based on Python. You can do stuff like 188/255. . That will return 0.737 to the field.

Note 255. ! Dot means that 255 is casted to float. Without it the calculation would be evaluated as int/int resulting in zero due to rounding rules (int/int -> 0.something -> 0).

Further you can access Math module by using m. A couple of examples of possible usage: m.sin(0.5), m.pi. See math module for more information. (http://docs.python.org/lib/module-math.html)

Ah cool. Handy to know.

Was just thinking up other things while writing about colours (colour temperature bar for lamps)

Cheers.

Attachments