Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Ture Pålsson
colour
Commits
c97158d5
Commit
c97158d5
authored
Mar 06, 2018
by
Ture Pålsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
colour.tex
colour.tex
+32
-0
colours.py
colours.py
+40
-0
No files found.
colour.tex
0 → 100644
View file @
c97158d5
\def\c
#1#2#3#4
{
% color fg name alt
\special
{
color push rgb #1
}
%
#3
%
\kern
.5em
\hbox
to 3em
{
%
\vrule
width 3em height 8pt depth 2pt
\hss
\hbox
to 3em
{
\special
{
color pop
}
\special
{
color push rgb #2
}
\hfil
#4
\hfil
}}
\special
{
color pop
}
%
}
%
\font\f
="Courier" at 10pt
\font\hf
=cmr17
\footline
=
{}
\hoffset
=-1in
\hsize
=210mm
\centerline
{
\hf
XTerm colour codes
}
\vskip
18pt
\f
\tabskip
=0pt plus 1fill
\halign
to
\hsize
{
%
\vrule
width 0pt height 10pt depth 5pt
#
\quad\tabskip
=0pt
&
#
\quad
&
#
\quad
&
#
\quad
&
#
\quad
&
#
\tabskip
=0pt plus 1fill
\cr
\input
coldata.tex
}
\bye
colours.py
0 → 100644
View file @
c97158d5
import
sys
def
ff
(
n
):
return
[
0x00
,
0x5f
,
0x87
,
0xaf
,
0xd7
,
0xff
][
n
]
def
c
():
columns
=
6
rows
=
216
/
columns
for
row
in
range
(
0
,
rows
):
items
=
[]
for
col
in
range
(
0
,
columns
):
c
=
col
*
rows
+
row
red
=
ff
(
c
//
36
)
green
=
ff
((
c
//
6
)
%
6
)
blue
=
ff
(
c
%
6
)
grey
=
.
21
*
red
+
.
71
*
green
+
.
07
*
blue
fgcolor
=
(
1
,
1
,
1
)
if
grey
<
128
else
(
0
,
0
,
0
)
name
=
'%02x%02x%02x'
%
(
red
,
green
,
blue
)
alt
=
'%d'
%
(
16
+
c
,)
items
.
append
(
'
\\
c{%(r)f %(g)f %(b)f}'
'{%(fr)f %(fg)f %(fb)f}'
'{%(name)s}{%(alt)s}'
%
{
'r'
:
red
/
255.0
,
'g'
:
green
/
255.0
,
'b'
:
blue
/
255.0
,
'fr'
:
fgcolor
[
0
],
'fg'
:
fgcolor
[
1
],
'fb'
:
fgcolor
[
2
],
'name'
:
name
,
'alt'
:
alt
})
sys
.
stdout
.
write
(
'%s
\\
cr
\n
'
%
(
'&'
.
join
(
items
),))
if
__name__
==
'__main__'
:
c
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment