-
Notifications
You must be signed in to change notification settings - Fork 2
/
colors.js
23 lines (20 loc) · 4.81 KB
/
colors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var colors = {
RED : 0,
GREEN : 0.333333333,
BLUE : 0.666666666,
DIYC_DIM : {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 2, 12: 2, 13: 2, 14: 2, 15: 2, 16: 2, 17: 2, 18: 2, 19: 2, 20: 2, 21: 2, 22: 2, 23: 2, 24: 2, 25: 2, 26: 2, 27: 2, 28: 2, 29: 2, 30: 2, 31: 3, 32: 3, 33: 3, 34: 3, 35: 3, 36: 3, 37: 3, 38: 3, 39: 3, 40: 3, 41: 3, 42: 3, 43: 3, 44: 3, 45: 3, 46: 3, 47: 3, 48: 3, 49: 3, 50: 3, 51: 4, 52: 4, 53: 4, 54: 4, 55: 4, 56: 4, 57: 4, 58: 4, 59: 4, 60: 4, 61: 4, 62: 4, 63: 4, 64: 4, 65: 4, 66: 5, 67: 5, 68: 5, 69: 5, 70: 5, 71: 5, 72: 5, 73: 5, 74: 5, 75: 5, 76: 6, 77: 6, 78: 6, 79: 6, 80: 6, 81: 6, 82: 6, 83: 6, 84: 6, 85: 6, 86: 7, 87: 7, 88: 7, 89: 7, 90: 7, 91: 7, 92: 7, 93: 7, 94: 8, 95: 8, 96: 8, 97: 9, 98: 9, 99: 9, 100: 9, 101: 9, 102: 9, 103: 9, 104: 10, 105: 10, 106: 10, 107: 11, 108: 11, 109: 11, 110: 11, 111: 11, 112: 12, 113: 12, 114: 12, 115: 13, 116: 13, 117: 13, 118: 14, 119: 14, 120: 14, 121: 14, 122: 15, 123: 15, 124: 15, 125: 16, 126: 16, 127: 16, 128: 17, 129: 17, 130: 17, 131: 17, 132: 17, 133: 18, 134: 18, 135: 19, 136: 19, 137: 20, 138: 20, 139: 21, 140: 21, 141: 22, 142: 22, 143: 23, 144: 23, 145: 24, 146: 24, 147: 25, 148: 25, 149: 26, 150: 26, 151: 27, 152: 27, 153: 28, 154: 29, 155: 29, 156: 30, 157: 31, 158: 31, 159: 32, 160: 32, 161: 33, 162: 33, 163: 34, 164: 35, 165: 36, 166: 37, 167: 38, 168: 39, 169: 40, 170: 40, 171: 41, 172: 42, 173: 43, 174: 44, 175: 45, 176: 46, 177: 47, 178: 48, 179: 49, 180: 50, 181: 51, 182: 52, 183: 53, 184: 55, 185: 56, 186: 57, 187: 59, 188: 60, 189: 61, 190: 62, 191: 64, 192: 65, 193: 67, 194: 68, 195: 70, 196: 71, 197: 73, 198: 74, 199: 76, 200: 77, 201: 78, 202: 80, 203: 82, 204: 84, 205: 86, 206: 88, 207: 90, 208: 92, 209: 94, 210: 96, 211: 99, 212: 102, 213: 104, 214: 107, 215: 109, 216: 111, 217: 114, 218: 116, 219: 118, 220: 120, 221: 123, 222: 126, 223: 128, 224: 130, 225: 133, 226: 136, 227: 139, 228: 142, 229: 145, 230: 148, 231: 152, 232: 156, 233: 160, 234: 164, 235: 168, 236: 172, 237: 176, 238: 180, 239: 183, 240: 185, 241: 190, 242: 195, 243: 200, 244: 205, 245: 210, 246: 214, 247: 218, 248: 223, 249: 227, 250: 230, 251: 235, 252: 240, 253: 245, 254: 250, 255: 255},
GAMMA25 : {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0, 21: 0, 22: 0, 23: 0, 24: 0, 25: 0, 26: 0, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1, 32: 1, 33: 1, 34: 1, 35: 1, 36: 2, 37: 2, 38: 2, 39: 2, 40: 2, 41: 2, 42: 2, 43: 3, 44: 3, 45: 3, 46: 3, 47: 3, 48: 4, 49: 4, 50: 4, 51: 4, 52: 5, 53: 5, 54: 5, 55: 5, 56: 6, 57: 6, 58: 6, 59: 6, 60: 7, 61: 7, 62: 7, 63: 8, 64: 8, 65: 8, 66: 9, 67: 9, 68: 9, 69: 10, 70: 10, 71: 10, 72: 11, 73: 11, 74: 11, 75: 12, 76: 12, 77: 13, 78: 13, 79: 14, 80: 14, 81: 14, 82: 15, 83: 15, 84: 16, 85: 16, 86: 17, 87: 17, 88: 18, 89: 18, 90: 19, 91: 19, 92: 20, 93: 21, 94: 21, 95: 22, 96: 22, 97: 23, 98: 23, 99: 24, 100: 25, 101: 25, 102: 26, 103: 27, 104: 27, 105: 28, 106: 29, 107: 29, 108: 30, 109: 31, 110: 31, 111: 32, 112: 33, 113: 34, 114: 34, 115: 35, 116: 36, 117: 37, 118: 37, 119: 38, 120: 39, 121: 40, 122: 41, 123: 42, 124: 42, 125: 43, 126: 44, 127: 45, 128: 46, 129: 47, 130: 48, 131: 49, 132: 50, 133: 51, 134: 52, 135: 52, 136: 53, 137: 54, 138: 55, 139: 56, 140: 57, 141: 59, 142: 60, 143: 61, 144: 62, 145: 63, 146: 64, 147: 65, 148: 66, 149: 67, 150: 68, 151: 69, 152: 71, 153: 72, 154: 73, 155: 74, 156: 75, 157: 77, 158: 78, 159: 79, 160: 80, 161: 82, 162: 83, 163: 84, 164: 85, 165: 87, 166: 88, 167: 89, 168: 91, 169: 92, 170: 93, 171: 95, 172: 96, 173: 98, 174: 99, 175: 100, 176: 102, 177: 103, 178: 105, 179: 106, 180: 108, 181: 109, 182: 111, 183: 112, 184: 114, 185: 115, 186: 117, 187: 119, 188: 120, 189: 122, 190: 123, 191: 125, 192: 127, 193: 128, 194: 130, 195: 132, 196: 133, 197: 135, 198: 137, 199: 138, 200: 140, 201: 142, 202: 144, 203: 145, 204: 147, 205: 149, 206: 151, 207: 153, 208: 155, 209: 156, 210: 158, 211: 160, 212: 162, 213: 164, 214: 166, 215: 168, 216: 170, 217: 172, 218: 174, 219: 176, 220: 178, 221: 180, 222: 182, 223: 184, 224: 186, 225: 188, 226: 190, 227: 192, 228: 194, 229: 197, 230: 199, 231: 201, 232: 203, 233: 205, 234: 207, 235: 210, 236: 212, 237: 214, 238: 216, 239: 219, 240: 221, 241: 223, 242: 226, 243: 228, 244: 230, 245: 233, 246: 235, 247: 237, 248: 240, 249: 242, 250: 245, 251: 247, 252: 250, 253: 252, 254: 255, 255: 255},
generate_gamma_table: function(steps, size, gamma){
steps = steps || 255;
size = size || 255;
gamma = gamma || 2.5;
//Returns a dictionary of gamma corrected values
var lookup = {};
for (var i = 0; i <= steps; i++){
var gval = Math.floor(size * Math.pow(((size / steps * (i + 1)) / size), gamma));
lookup[i] = Math.min(gval, size);
}
return lookup;
}
}
module.exports = colors;