Dracula color scheme
2023. 02. 28. 11:26 | \English \programming
I do love this color scheme.
So, I've been frequently check out the Dracula color scheme's github page to get the color codes (who can memorize them all?) and its specs to use in various projects, such as this website's template as you can see.
I never had a really easy to access version of it. UNTIL NOW!
Behold my beautiful table containing all the necessary information!
Color name | Hex | Dec | |
---|---|---|---|
Background | #282A36 | 40, 42, 54 | |
Foreground | #F8F8F2 | 248, 248, 242 | |
Selection | #44475A | 68, 71, 90 | |
Comment | #6272A4 | 98, 114, 164 | |
Red | #FF5555 | 255, 85, 85 | |
Orange | #FFB86C | 255, 184, 108 | |
Yellow | #F1FA8C | 241, 250, 140 | |
Green | #50FA7B | 80, 250, 123 | |
Purple | #BD93F9 | 189, 147, 249 | |
Cyan | #8BE9FD | 139, 233, 253 | |
Pink | #FF79C6 | 255, 121, 198 | |
AnsiBlack | #21222C | 33, 34, 44 | |
AnsiRed | #FF5555 | 255, 85, 85 | |
AnsiGreen | #50FA7B | 80, 250, 123 | |
AnsiYellow | #F1FA8C | 241, 250, 140 | |
AnsiBlue | #BD93F9 | 189, 147, 249 | |
AnsiMagenta | #FF79C6 | 255, 121, 198 | |
AnsiCyan | #8BE9FD | 139, 233, 253 | |
AnsiWhite | #F8F8F2 | 248, 248, 242 | |
AnsiBrightBlack | #6272A4 | 98, 114, 164 | |
AnsiBrightRed | #FF6E6E | 255, 110, 110 | |
AnsiBrightGreen | #69FF94 | 105, 255, 148 | |
AnsiBrightYellow | #FFFFA5 | 255, 255, 165 | |
AnsiBrightBlue | #D6ACFF | 214, 172, 255 | |
AnsiBrightMagenta | #FF92DF | 255, 146, 223 | |
AnsiBrightCyan | #A4FFFF | 164, 255, 255 | |
AnsiBrightWhite | #FFFFFF | 255, 255, 255 |
(based on the official Dracula color scheme's specs as of 2023-02-28)
Alright, it's not the best, but it's functional and easy to access through the zotn.hu/dracula URL. Admittedly, it's mostly for me, but if you'd like to re-generate this thing, here's the code I put bodged together:
#! /usr/bin/env python3
from textwrap import wrap
from pprint import pprint
MASTER = """Background
#282A36
Foreground
#F8F8F2
Selection
#44475A
Comment
#6272A4
Red
#FF5555
Orange
#FFB86C
Yellow
#F1FA8C
Green
#50FA7B
Purple
#BD93F9
Cyan
#8BE9FD
Pink
#FF79C6
AnsiBlack
#21222C
AnsiRed
#FF5555
AnsiGreen
#50FA7B
AnsiYellow
#F1FA8C
AnsiBlue
#BD93F9
AnsiMagenta
#FF79C6
AnsiCyan
#8BE9FD
AnsiWhite
#F8F8F2
AnsiBrightBlack
#6272A4
AnsiBrightRed
#FF6E6E
AnsiBrightGreen
#69FF94
AnsiBrightYellow
#FFFFA5
AnsiBrightBlue
#D6ACFF
AnsiBrightMagenta
#FF92DF
AnsiBrightCyan
#A4FFFF
AnsiBrightWhite
#FFFFFF"""
TD_STYLE = "padding: 0.5em;"
TD_NAME_STYLE = "text-align: left;"
TD_CLR_STYLE = "text-align: center; white-space: pre;"
TD_SAMPLE_STYLE = "background-color:{};"
SOURCE = "https://spec.draculatheme.com/"
def create_master_table():
out = []
tmp = []
for line in MASTER.split():
if (line[0] != '#'):
tmp.append(line)
continue
n = wrap(line[1:], 2)
tmp.append(line)
dec = []
for m in n:
dec.append(int(m, 16))
tmp.append(dec)
out.append(tmp)
tmp = []
return out
def frame_html(text):
return f"""<table style="margin-bottom: 1em; margin-top: 2em;">
<caption style="font-size: 150%; font-weight: 600;">Dracula color scheme</caption>
<tr>
<th></th><th>Color name</th><th>Hex</th><th>Dec</th>
</tr>
{text}
</table>
<p style="margin-top: 0.3ch; font-size: 90%; font-style: italic;">(based on
<a href="{SOURCE}">the official Dracula color scheme's specs</a>
as of 2023-02-28)</p>"""
def td_style(color=False):
if (color == False):
return TD_STYLE + TD_NAME_STYLE
elif (isinstance(color, str)):
return TD_SAMPLE_STYLE.format(color)
return TD_STYLE + TD_CLR_STYLE
def frame_td(s, style):
if isinstance(s, list):
s = ", ".join([str(x).rjust(3, ' ') for x in s])
return f'<td style="{style}">{s}</td>'
def frame_tr(text, hexa, deci):
return ("<tr>"
+ frame_td(" ", td_style(hexa))
+ frame_td(text, td_style())
+ frame_td(hexa, td_style(True))
+ frame_td(deci, td_style(True))
+ "</tr>")
def main():
table = create_master_table()
pprint(table)
out = ""
for t in table:
pprint(t)
out += frame_tr(*t)
out = frame_html(out)
print(out)
if __name__ == "__main__":
main()
< Custom notification sounds | drawing attempt >