Skip to content

Instantly share code, notes, and snippets.

@nst
Last active January 19, 2025 20:27
Show Gist options
  • Save nst/68fb5028de2067a1ea164e03dbad8ad9 to your computer and use it in GitHub Desktop.
Save nst/68fb5028de2067a1ea164e03dbad8ad9 to your computer and use it in GitHub Desktop.
Amstrad CPC Color Palette in PostScript, take 1
%!PS
%%Title: cpc.ps
%%Creator: Nicolas Seriot
% January 2025
% Amstrad CPC Color Palette
% https://www.cpcwiki.eu/index.php/CPC_Palette
% https://seriot.ch/projects/drawing_with_computers.html
% https://bsky.app/profile/nst021.bsky.social/post/3leytevn6ck25
/S 32 def
/N 2 def % steps 0-1-2
/_r_g_b_m_DrawSide {
gsave
concat
/B exch def
/G exch def
/R exch def
0 1 N {
/x exch def
gsave
0 1 N {
/y exch def
R G B setrgbcolor
0 0 S S rectfill
0 setgray
0 0 S S rectstroke
0 S translate
} for
grestore
S 0 translate
} for
grestore
} def
/_a_b_c_DrawCube {
/c exch def
/b exch def
/a exch def
gsave
c 1 eq { [-1 0 0 1 0 0] concat } if % flip left-right
{ b } { c } { a } [ 1 0.5 -1 0.5 0 0 ] _r_g_b_m_DrawSide % top
{ c } { b } { a } [ 1 0.5 0 -1 0 0 ] _r_g_b_m_DrawSide % right
{ a } { b } { c } [ -1 0.5 0 -1 0 0 ] _r_g_b_m_DrawSide % left
grestore
} def
200 500 translate
gsave
{ x N div } { y N div } 0 _a_b_c_DrawCube
240 0 translate
{ N x sub N div } { N y sub N div } 1 _a_b_c_DrawCube
grestore
120 -100 translate
/N 0 def
0.5 0.5 0.5 _a_b_c_DrawCube
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment