Skip to content

Commit

Permalink
Merge pull request #11 from Quansight-Labs/add-github-hcontrast
Browse files Browse the repository at this point in the history
Add github light and dark high contrast
  • Loading branch information
steff456 authored Oct 19, 2022
2 parents d9517cd + 50ecfb0 commit 28c9824
Show file tree
Hide file tree
Showing 13 changed files with 560 additions and 0 deletions.
23 changes: 23 additions & 0 deletions a11y_pygments/github_dark_high_contrast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Github dark high contrast

This is the pygments implementation of [`github dark (Default)`](https://github.com/primer/github-vscode-theme).

![Screenshot of the dark accessibility theme in a bash script](./images/github-dark-hc.png)

## Colors

Background color: ![#0d1117](https://via.placeholder.com/20/0d1117/0d1117.png) `#0d1117`

Highlight color: ![#58A6FF](https://via.placeholder.com/20/58A6FF/58A6FF.png) `#58A6FF`

**WCAG compliance**

| Color | Hex | Ratio | Normal text | Large text |
| ----- | --- | ----- | ----------- | ---------- |
| ![#d9dee3](https://via.placeholder.com/20/d9dee3/d9dee3.png) | `#d9dee3` | 14.1 : 1 | AAA | AAA |
| ![#ff9492](https://via.placeholder.com/20/ff9492/ff9492.png) | `#ff9492` | 8.9 : 1 | AAA | AAA |
| ![#ffb757](https://via.placeholder.com/20/ffb757/ffb757.png) | `#ffb757` | 11.1 : 1 | AAA | AAA |
| ![#72f088](https://via.placeholder.com/20/72f088/72f088.png) | `#72f088` | 13.1 : 1 | AAA | AAA |
| ![#91cbff](https://via.placeholder.com/20/91cbff/91cbff.png) | `#91cbff` | 11.1 : 1 | AAA | AAA |
| ![#dbb7ff](https://via.placeholder.com/20/dbb7ff/dbb7ff.png) | `#dbb7ff` | 11.1 : 1 | AAA | AAA |
| ![#C9D1D9](https://via.placeholder.com/20/C9D1D9/C9D1D9.png) | `#C9D1D9` | 12.3 : 1 | AAA | AAA |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions a11y_pygments/github_dark_high_contrast/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.hll { background-color: #58A6FF }
.c { color: #d9dee3 } /* Comment */
.err { color: #ff9492 } /* Error */
.k { color: #ff9492 } /* Keyword */
.l { color: #ffb757 } /* Literal */
.n { color: #dbb7ff } /* Name */
.o { color: #72f088 } /* Operator */
.p { color: #C9D1D9 } /* Punctuation */
.ch { color: #d9dee3 } /* Comment.Hashbang */
.cm { color: #d9dee3 } /* Comment.Multiline */
.cp { color: #d9dee3 } /* Comment.Preproc */
.cpf { color: #d9dee3 } /* Comment.PreprocFile */
.c1 { color: #d9dee3 } /* Comment.Single */
.cs { color: #d9dee3 } /* Comment.Special */
.gd { color: #91cbff } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #ff9492 } /* Generic.Error */
.gh { color: #91cbff } /* Generic.Heading */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #91cbff } /* Generic.Subheading */
.kc { color: #91cbff } /* Keyword.Constant */
.kd { color: #ff9492 } /* Keyword.Declaration */
.kn { color: #ff9492 } /* Keyword.Namespace */
.kp { color: #ff9492 } /* Keyword.Pseudo */
.kr { color: #ff9492 } /* Keyword.Reserved */
.kt { color: #ff9492 } /* Keyword.Type */
.ld { color: #ffb757 } /* Literal.Date */
.m { color: #ffb757 } /* Literal.Number */
.s { color: #91cbff } /* Literal.String */
.na { color: #ffb757 } /* Name.Attribute */
.nb { color: #ffb757 } /* Name.Builtin */
.nc { color: #91cbff } /* Name.Class */
.no { color: #91cbff } /* Name.Constant */
.nd { color: #ffb757 } /* Name.Decorator */
.ni { color: #72f088 } /* Name.Entity */
.ne { color: #dbb7ff } /* Name.Exception */
.nf { color: #91cbff } /* Name.Function */
.nl { color: #ffb757 } /* Name.Label */
.nn { color: #C9D1D9 } /* Name.Namespace */
.nx { color: #dbb7ff } /* Name.Other */
.py { color: #91cbff } /* Name.Property */
.nt { color: #72f088 } /* Name.Tag */
.nv { color: #ffb757 } /* Name.Variable */
.ow { color: #dbb7ff } /* Operator.Word */
.pm { color: #C9D1D9 } /* Punctuation.Marker */
.w { color: #C9D1D9 } /* Text.Whitespace */
.mb { color: #ffb757 } /* Literal.Number.Bin */
.mf { color: #ffb757 } /* Literal.Number.Float */
.mh { color: #ffb757 } /* Literal.Number.Hex */
.mi { color: #ffb757 } /* Literal.Number.Integer */
.mo { color: #ffb757 } /* Literal.Number.Oct */
.sa { color: #91cbff } /* Literal.String.Affix */
.sb { color: #91cbff } /* Literal.String.Backtick */
.sc { color: #91cbff } /* Literal.String.Char */
.dl { color: #91cbff } /* Literal.String.Delimiter */
.sd { color: #91cbff } /* Literal.String.Doc */
.s2 { color: #91cbff } /* Literal.String.Double */
.se { color: #91cbff } /* Literal.String.Escape */
.sh { color: #91cbff } /* Literal.String.Heredoc */
.si { color: #91cbff } /* Literal.String.Interpol */
.sx { color: #91cbff } /* Literal.String.Other */
.sr { color: #91cbff } /* Literal.String.Regex */
.s1 { color: #91cbff } /* Literal.String.Single */
.ss { color: #91cbff } /* Literal.String.Symbol */
.bp { color: #ffb757 } /* Name.Builtin.Pseudo */
.fm { color: #91cbff } /* Name.Function.Magic */
.vc { color: #ffb757 } /* Name.Variable.Class */
.vg { color: #ffb757 } /* Name.Variable.Global */
.vi { color: #ffb757 } /* Name.Variable.Instance */
.vm { color: #ffb757 } /* Name.Variable.Magic */
.il { color: #ffb757 } /* Literal.Number.Integer.Long */
.highlight { background: #0d1117; color: #C9D1D9; }
102 changes: 102 additions & 0 deletions a11y_pygments/github_dark_high_contrast/style.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from pygments.style import Style
from pygments.token import (
Keyword, Name, Comment, String, Error, Text, Number, Operator, Generic,
Punctuation, Other, Literal)


class Colors:
comment = "#d9dee3" # grey[2]
red = "#ff9492" # red[3]
orange = "#ffb757" # orange[2]
green = "#72f088" # green[1]
blue = "#91cbff" # blue[2]
purple = "#dbb7ff" # purple[2]
black = "#C9D1D9" # fg.default


class Theme(Style):
"""
This style mimics the github dark high contrast theme from vs code themes.
"""

default_style = ''

background_color = "#0d1117" # canvas.default
highlight_color = "#58A6FF" # accent.fg

styles = {
Text: Colors.black, # class: ''
Error: Colors.red, # class: 'err'
Other: "", # class 'x'

Comment: Colors.comment, # class: 'c'

Keyword: Colors.red, # class: 'k'
Keyword.Constant: Colors.blue, # class: 'kc'
# Keyword.Declaration: "", # class: 'kd'
# Keyword.Namespace: "", # class: 'kn'
# Keyword.Pseudo: "", # class: 'kp'
# Keyword.Reserved: "", # class: 'kr'
Keyword.Type: Colors.red, # class: 'kt'

Operator: Colors.green, # class: 'o'
Operator.Word: Colors.purple, # class: 'ow'

Punctuation: Colors.black, # class: 'p'

Name: Colors.purple, # class: 'n'
Name.Attribute: Colors.orange, # class: 'na'
Name.Builtin: Colors.orange, # class: 'nb'
Name.Builtin.Pseudo: Colors.orange, # class: 'bp'
Name.Class: Colors.blue, # class: 'nc'
Name.Constant: Colors.blue, # class: 'no'
Name.Decorator: Colors.orange, # class: 'nd'
Name.Entity: Colors.green, # class: 'ni'
Name.Exception: Colors.purple, # class: 'ne'
Name.Function: Colors.blue, # class: 'nf'
Name.Property: Colors.blue, # class: 'py'
Name.Label: Colors.orange, # class: 'nl'
Name.Namespace: Colors.black, # class: 'nn'
# Name.Other: "", # class: 'nx'
Name.Tag: Colors.green, # class: 'nt'
Name.Variable: Colors.orange, # class: 'nv'
Name.Variable.Magic: Colors.orange,
# Name.Variable.Class: "", # class: 'vc'
# Name.Variable.Global: "", # class: 'vg'
# Name.Variable.Instance: "", # class: 'vi'

Number: Colors.orange, # class: 'm'
# Number.Float: "", # class: 'mf'
# Number.Hex: "", # class: 'mh'
# Number.Integer: "", # class: 'mi'
# Number.Integer.Long: "", # class: 'il'
# Number.Oct: "", # class: 'mo'

Literal: Colors.orange, # class: 'l'
# Literal.Date: "", # class: 'ld'

String: Colors.blue, # class: 's'
String.Backtick: Colors.blue, # class: 'sb'
# String.Char: "", # class: 'sc'
# String.Doc: "", # class: 'sd'
# String.Double: "", # class: 's2'
# String.Escape: "", # class: 'se'
# String.Heredoc: "", # class: 'sh'
# String.Interpol: "", # class: 'si'
# String.Other: "", # class: 'sx'
String.Regex: Colors.blue, # class: 'sr'
# String.Single: "", # class: 's1'
String.Symbol: Colors.blue, # class: 'ss'

# Generic: "", # class: 'g'
Generic.Deleted: Colors.blue, # class: 'gd',
Generic.Emph: "italic", # class: 'ge'
Generic.Error: Colors.red, # class: 'gr'
Generic.Heading: Colors.blue, # class: 'gh'
Generic.Subheading: Colors.blue, # class: 'gu'
# Generic.Inserted: "", # class: 'gi'
# Generic.Output: "", # class: 'go'
# Generic.Prompt: "", # class: 'gp'
Generic.Strong: "bold", # class: 'gs'
# Generic.Traceback: "", # class: 'gt'
}
23 changes: 23 additions & 0 deletions a11y_pygments/github_light_high_contrast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Github light high contrast

This is the pygments implementation of [`github light high contrast`](https://github.com/primer/github-vscode-theme).

![Screenshot of the light accessibility theme in a bash script](./images/github-light-hc.png)

## Colors

Background color: ![#ffffff](https://via.placeholder.com/20/ffffff/ffffff.png) `#ffffff`

Highlight color: ![#0969da](https://via.placeholder.com/20/0969da/0969da.png) `#0969da`

**WCAG compliance**

| Color | Hex | Ratio | Normal text | Large text |
| ----- | --- | ----- | ----------- | ---------- |
| ![#66707b](https://via.placeholder.com/20/66707b/66707b.png) | `#66707b` | 5.1 : 1 | AA | AAA |
| ![#a0111f](https://via.placeholder.com/20/a0111f/a0111f.png) | `#a0111f` | 8.1 : 1 | AAA | AAA |
| ![#702c00](https://via.placeholder.com/20/702c00/702c00.png) | `#702c00` | 10.2 : 1 | AAA | AAA |
| ![#024c1a](https://via.placeholder.com/20/024c1a/024c1a.png) | `#024c1a` | 10.2 : 1 | AAA | AAA |
| ![#023b95](https://via.placeholder.com/20/023b95/023b95.png) | `#023b95` | 10.2 : 1 | AAA | AAA |
| ![#622cbc](https://via.placeholder.com/20/622cbc/622cbc.png) | `#622cbc` | 8.1 : 1 | AAA | AAA |
| ![#24292f](https://via.placeholder.com/20/24292f/24292f.png) | `#24292f` | 14.7 : 1 | AAA | AAA |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions a11y_pygments/github_light_high_contrast/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.hll { background-color: #0969da }
.c { color: #66707b } /* Comment */
.err { color: #a0111f } /* Error */
.k { color: #a0111f } /* Keyword */
.l { color: #702c00 } /* Literal */
.n { color: #622cbc } /* Name */
.o { color: #024c1a } /* Operator */
.p { color: #24292f } /* Punctuation */
.ch { color: #66707b } /* Comment.Hashbang */
.cm { color: #66707b } /* Comment.Multiline */
.cp { color: #66707b } /* Comment.Preproc */
.cpf { color: #66707b } /* Comment.PreprocFile */
.c1 { color: #66707b } /* Comment.Single */
.cs { color: #66707b } /* Comment.Special */
.gd { color: #023b95 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #a0111f } /* Generic.Error */
.gh { color: #023b95 } /* Generic.Heading */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #023b95 } /* Generic.Subheading */
.kc { color: #023b95 } /* Keyword.Constant */
.kd { color: #a0111f } /* Keyword.Declaration */
.kn { color: #a0111f } /* Keyword.Namespace */
.kp { color: #a0111f } /* Keyword.Pseudo */
.kr { color: #a0111f } /* Keyword.Reserved */
.kt { color: #a0111f } /* Keyword.Type */
.ld { color: #702c00 } /* Literal.Date */
.m { color: #702c00 } /* Literal.Number */
.s { color: #023b95 } /* Literal.String */
.na { color: #702c00 } /* Name.Attribute */
.nb { color: #702c00 } /* Name.Builtin */
.nc { color: #023b95 } /* Name.Class */
.no { color: #023b95 } /* Name.Constant */
.nd { color: #702c00 } /* Name.Decorator */
.ni { color: #024c1a } /* Name.Entity */
.ne { color: #622cbc } /* Name.Exception */
.nf { color: #023b95 } /* Name.Function */
.nl { color: #702c00 } /* Name.Label */
.nn { color: #24292f } /* Name.Namespace */
.nx { color: #622cbc } /* Name.Other */
.py { color: #023b95 } /* Name.Property */
.nt { color: #024c1a } /* Name.Tag */
.nv { color: #702c00 } /* Name.Variable */
.ow { color: #622cbc } /* Operator.Word */
.pm { color: #24292f } /* Punctuation.Marker */
.w { color: #24292f } /* Text.Whitespace */
.mb { color: #702c00 } /* Literal.Number.Bin */
.mf { color: #702c00 } /* Literal.Number.Float */
.mh { color: #702c00 } /* Literal.Number.Hex */
.mi { color: #702c00 } /* Literal.Number.Integer */
.mo { color: #702c00 } /* Literal.Number.Oct */
.sa { color: #023b95 } /* Literal.String.Affix */
.sb { color: #023b95 } /* Literal.String.Backtick */
.sc { color: #023b95 } /* Literal.String.Char */
.dl { color: #023b95 } /* Literal.String.Delimiter */
.sd { color: #023b95 } /* Literal.String.Doc */
.s2 { color: #023b95 } /* Literal.String.Double */
.se { color: #023b95 } /* Literal.String.Escape */
.sh { color: #023b95 } /* Literal.String.Heredoc */
.si { color: #023b95 } /* Literal.String.Interpol */
.sx { color: #023b95 } /* Literal.String.Other */
.sr { color: #023b95 } /* Literal.String.Regex */
.s1 { color: #023b95 } /* Literal.String.Single */
.ss { color: #023b95 } /* Literal.String.Symbol */
.bp { color: #702c00 } /* Name.Builtin.Pseudo */
.fm { color: #023b95 } /* Name.Function.Magic */
.vc { color: #702c00 } /* Name.Variable.Class */
.vg { color: #702c00 } /* Name.Variable.Global */
.vi { color: #702c00 } /* Name.Variable.Instance */
.vm { color: #702c00 } /* Name.Variable.Magic */
.il { color: #702c00 } /* Literal.Number.Integer.Long */
.highlight { background: #ffffff; color: #24292f; }
Loading

0 comments on commit 28c9824

Please sign in to comment.