Skip to content

palette

Aaron Snoswell edited this page Jun 11, 2019 · 30 revisions

Palette

TIC standard palette is DB16:

DB16

Color Name Index Hex
Black 0 140C1C
Dark Red 1 442434
Dark Blue 2 30346D
Dark Gray 3 4E4A4F
Brown 4 854C30
Dark Green 5 346524
Red 6 D04648
Light Gray 7 757161
Light Blue 8 597DCE
Orange 9 D27D2C
Blue/Gray 10 8595A1
Light Green 11 6DAA2C
Peach 12 D2AA99
Cyan 13 6DC2CA
Yellow 14 DAD45E
White 15 DEEED6

You can customize the palette using poke command or using config.lua.

As of 0.18.0, you can also set a game's palette with Cartridge Metadata:

--pal: DB16

You can even define a completely custom palette by setting the metadata as a concatenated hex color string:

--pal: 00000057420040318d5050508b542955a0498839327878788b3f967869c49f9f9f94e089b8696267b6bdbfce72ffffff

--pal: metatag is deprecated in 0.27.0, added Palette Editor where you can paste hex palette string

An exposition of the palettes already included with TIC:

TIC palettes

Another 8 color palette for use in cartridge.

Color palettes as is. Can be used as a palette for the game - the order of colors corresponds to the original.

-- COMMODORE VIC-20 PALETTE
-- pal: 000000ffffffa8734ae9b287772d26b6686285d4dcc5ffffa85fb4e99df5559e4a92df8742348b7e70cabdcc71ffffb0
-- STILL LIFE PALETTE
-- pal: 3f28117a2222d13b27e07f8a5d853a68c127b3e868122615513155286fb89b8bffa8e4d4cc8218c7b581000000ffffff
-- JAPANESE MACHINE PALETTE 
-- pal: 00000019102846af45a1d685453e787664fe8331299ec2e8dc534be18d79d6b97be9d8a1216c4bd365c8afaab9f5f4eb
-- CGARNE PALETTE
-- pal: 0000005e606e2234d10c7e455c2e78b5b5b5FFFFFFffd93f7be2f98a36224c81fb44aacceb8a60aa5c3d6cd947e23d69
-- PSYGNOSIA PALETTE
-- pal: 0000001b1e29362747443f4152524c64647c73615077785b9ea4a7cbe8f7e08b79a2324e003308084a3c546a00516cbf
-- COLOR GRAPHICS ADAPTER PALETTE
-- pal: 000000555555AAAAAAFFFFFF0000AA5555FF00AA0055FF5500AAAA55FFFFAA0000FF5555AA00AAFF55FFAA5500FFFF55
-- EROGE COPPER PALETTE
-- pal: 0d080d4f2b24825b31c59154f0bd77fbdf9bfff9e4bebbb27bb24e74adbb4180a032535f2a23497d3840c16c5be89973
-- EASTER ISLAND PALETTE 
-- pal: f6f6bfe6d1d1868691794765f5e17aedc38dcc8d86ca657e39d4b98dbcd28184ab6860869dc0857ea788567864051625
-- From dark to light below:
-- pal: 0516255678647ea7889dc0856860868184ab8dbcd239d4b9ca657ecc8d86edc38df5e17a794765868691e6d1d1f6f6bf
-- PICO-8 PALETTE
-- pal: 0000001D2B537E255383769CAB5236008751FF004D5F574FFF77A8FFA300C2C3C700E436FFCCAA29ADFFFFEC27FFF1E8
-- Original PICO-8 order
-- pal: 0000001D2B537E2553008751AB52365F574FC2C3C7FFF1E8FF004DFFA300FFEC2700E43629ADFF83769CFF77A8FFCCAA
-- GRAYSCALE
-- pal: 000000111111222222333333444444555555666666777777888888999999aaaaaabbbbbbccccccddddddeeeeeeffffff
-- SWEETIE 16 PALETTE
-- pal: 1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
-- MICROSOFT WINDOWS PALETTE
-- pal: 0000007e7e7ebebebeffffff7e0000ff0000007e0000ff007e7e00ffff0000007e0000ff7e007eff00ff007e7e00ffff

Some useful JavaScript 16-color palette functions for the console in your browser:

function reverse(x){return typeof x==="string"?x.split("").reverse().join(""):x.reverse();}
function chunkString(string,n){
	var chunks=[];
	for(var i=0;i<string.length;i+=n){
		chunks.push(string.substring(i,i+n));
	}
	return chunks;
}
function hexChars(string){return string.replace(/[^0-9A-F]/gi,"");}
function hexTo24RGB(string){
	return chunkString(hexChars(string).substring(0,6),2).map(x=>parseInt(x,16));
}
function perceivedBrightness(R,G,B){ //Doesn't matter what range R, G and B is within.
	return Math.sqrt((.299*(R**2))+(.587*(G**2))+(.114*(B**2)));
}
function sortPaletteByBrightness(array){ //From dark to bright.
	array=array.map(x=>{
		if(typeof x==="string"){return hexTo24RGB(x);}
		return x;
	});
	return array.sort((x,y)=>perceivedBrightness(...x)-perceivedBrightness(...y));
}
function rgbArrayToHex(array){
	return array.flat().map(x=>x.toString(16).padStart(2,"0")).join("");
}
function hexToRgbArray(string){
	return chunkString(hexChars(string),6).map(x=>chunkString(x,2).map(y=>parseInt(y,16)));
}
function makeSortedPalette(string){
	return rgbArrayToHex(sortPaletteByBrightness(string.split(/\s+/).filter(x=>x)));
}
function visualizePalette(string){ //Normal TIC-80 palette string as a parameter.
	chunkString(string,6).forEach((x,i)=>{
		console.log(`${String(i).padStart(2)}: %c${x}`,`background-color:#${x};color:#${perceivedBrightness(...hexTo24RGB(x))<100?"fff":"000"}`);
	});
}

Online Palette Editor

See also, an online TIC-80 palette-editing tool.

You can’t perform that action at this time.