Created
October 6, 2020 17:05
-
-
Save Cardosaum/5ed533091187c1dc6ce5a0e150db5905 to your computer and use it in GitHub Desktop.
script to modify anki default colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set path for default files | |
path="$1" | |
cd "$path" | |
ch () { | |
files=$(rg -t css -t svg -l "." $p) | |
sed -E -i "s/$1/$2/" $files | |
} | |
# set default colors | |
# you can find them all in the official specification site | |
# https://draculatheme.com/contribute/ | |
background="#282a36" | |
currentline="#44475a" | |
foreground="#f8f8f2" | |
comment="#6272a4" | |
cyan="#8be9fd" | |
green="#50fa7b" | |
orange="#ffb86c" | |
pink="#ff79c6" | |
purple="#bd93f9" | |
red="#ff5555" | |
yellow="#f1fa8" | |
# deckbrowser | |
ch "\s#5CcC00;" " $green;" | |
ch "\s#FF935B;" " $orange;" | |
ch "\s#444;" " $currentline;" | |
ch "\s#e7e7e7;" " $foreground;" | |
ch "\s#29292B;" " $background;" | |
ch "\s#777;" " $comment;" | |
ch "\s#000;" " $background;" | |
ch "\s#77ccff\s" " $cyan " | |
ch "\s#aa5555;" " $red;" | |
ch "\s#3a3a3a;" " $currentline;" | |
# webview.css | |
ch "\s#00a;" " $green;" | |
ch "\s#222222;" " $comment;" | |
ch "\s#2f2f31;" " $background;" | |
ch "\s#555555\s" " $currentline " | |
ch "\s#646464;" " $comment;" | |
ch "\s#656565 " " $currentline " | |
ch "\s#656565;" " $currentline;" | |
ch "\s#77ccff;" " $cyan;" | |
ch "\s#848484;" " $comment;" | |
ch "\s#aaa;" " $comment;" | |
ch "\s#e5e5e5;" " $comment;" | |
ch "\sblack;" " $background;" | |
ch "\swhite;" " $foreground;" | |
# overview.css | |
ch "\s#ccc;" " $foreground;" | |
# reviewer.css | |
ch "\s#0f0;" " $green;" | |
ch "\s#f00;" " $red;" | |
ch "\s#fff;" " $foreground;" | |
ch "\s#414141;" " $comment;" | |
# _vars.scss | |
ch "\s#555555;" " $background;" | |
# svg images and buttons | |
ch "\s#808080" " $pink;" | |
ch "border-radius: 2px;" "border-radius: 20px;" | |
ch "border-radius: 3px;" "border-radius: 30px;" | |
ch "border-radius: 8px;" "border-radius: 80px;" | |
rev=$(fd -a "reviewer.css" | head -n 1) | |
cat <<EOT >> "${rev}" | |
/* dracula color and layout changes */ | |
.type { | |
color: #a6acbf; | |
font-size: 70%; | |
font-weight: bold; | |
margin-bottom: .25em; | |
text-transform: uppercase; | |
} | |
code#typeans { | |
text-align: center; | |
max-width: 300px; | |
color: #f8f8f2; | |
font-size: 20px; | |
} | |
input#typeans { | |
border-radius: 9px; | |
} | |
.typeGood { | |
background-color: #50fa7b; | |
color: #282a36; | |
} | |
.typeBad { | |
background-color: #ff5555; | |
color: #282a36; | |
} | |
.typeMissed { | |
background: #6272a4; | |
} | |
html { | |
overflow: scroll; | |
overflow-x: hidden; | |
background-color: #282a36; | |
} | |
/* CONTAINER FOR YOUR CARDS */ | |
#kard { | |
padding: 0px 0px; | |
max-width: 1000px; | |
margin: 0 auto; | |
word-wrap: break-word; | |
background-color: #282a36; | |
} | |
/* APPLIES TO THE WHOLE CARD */ | |
.card { | |
font-family: "Droid Sans", "Code New Roman", Mono, "Times New Roman", Baskervville, Inconcolata; | |
font-size: 18px; | |
text-align: center; | |
color: #f8f8f2; | |
background-color: #282a36; | |
} | |
/* STYLE FOR CLOZE DELETIONS */ | |
.cloze, .cloze b, .cloze u, .cloze i { | |
font-weight: bold; | |
color: MediumSeaGreen; | |
} | |
/* STYLE FOR EXTRA PORTION ON BACK OF CARD */ | |
#extra, #extra i { | |
font-size: 15px; | |
color: #D7DEE9; | |
font-style: italic; | |
} | |
/* STYLE TAGS TO APPEAR WHEN HOVERING OVER TOP OF CARD */ | |
.tags { | |
color: #A6ABB9; | |
opacity: 0; | |
font-size: 10px; | |
width: 100%; | |
text-align: center; | |
position: fixed; | |
padding: 0; | |
top: 0; | |
right: 0; | |
} | |
.tags:hover { | |
opacity: 1; | |
position: fixed; | |
} | |
/* IMAGE STYLE */ | |
img { | |
display: block-inline; | |
max-width: 100%; | |
max-height: 100%; | |
} | |
tr { | |
font-size: 12px; | |
} | |
div.org-src-container { | |
text-align: left; | |
} | |
/* COLOR ACCENTS FOR BOLD-ITALICS-UNDERLINE */ | |
/* BOLD STYLE */ | |
b { | |
font-weight: bold; | |
color: $pink; | |
} | |
/* UNDERLINE STYLE */ | |
u { | |
text-decoration: none; | |
color: #bd93f9; | |
} | |
.underline { | |
text-decoration: none; | |
color: #bd93f9; | |
} | |
/* STRIKE-THROUGH STYLE */ | |
del { | |
color: #6272a4; | |
} | |
/* ITALICS STYLE */ | |
i { | |
font-weight: normal; | |
font-style: italic; | |
text-decoration: none; | |
color: #8be9fd; | |
} | |
/* LINK STYLE */ | |
a:link { | |
text-decoration: underline; | |
background-color: transparent; | |
color: #f1fa8c; | |
} | |
ul { | |
text-align: left | |
} | |
/* LINK STYLE */ | |
/* ADJUSTMENT FOR MOBILE DEVICES */ | |
.mobile .card { | |
color: black; | |
background-color: #282a36; | |
} | |
.mobile .tags:hover { | |
opacity: 1; | |
position: relative; | |
} | |
#mcsheader { | |
font-style: italic; | |
font-family: Times New Roman; | |
font-size: 10px; | |
text-align: left; | |
} | |
code { | |
text-decoration: none; | |
font-family: "Source Code Pro"; | |
font-size: 16px; | |
color: #50fa7b; | |
} | |
/* ORG MODE */ | |
pre.example { | |
text-align: left; | |
text-decoration: none; | |
font-family: "Source Code Pro"; | |
font-size: 16px; | |
color: #6272a4; | |
} | |
/* MCS special tags */ | |
:root { | |
--mcs-color-dracula-background: #282a36; | |
--mcs-color-dracula-currentline: #44475a; | |
--mcs-color-dracula-foreground: #f8f8f2; | |
--mcs-color-dracula-comment: #6272a4; | |
--mcs-color-dracula-cyan: #8be9fd; | |
--mcs-color-dracula-green: #50fa7b; | |
--mcs-color-dracula-orange: #ffb86c; | |
--mcs-color-dracula-pink: #ff79c6; | |
--mcs-color-dracula-purple: #bd93f9; | |
--mcs-color-dracula-red: #ff5555; | |
--mcs-color-dracula-yellow: #f1fa8c; | |
} | |
mcsCyan{ | |
color: #8be9fd; | |
} | |
mcsGreen{ | |
color: #50fa7b; | |
} | |
mcsOrange{ | |
color: #ffb86c; | |
} | |
mcsPink{ | |
color: #ff79c6; | |
} | |
mcsPurple{ | |
color: #bd93f9; | |
} | |
mcsRed{ | |
color: #ff5555; | |
} | |
mcsYellow{ | |
color: #f1fa8c; | |
} | |
mcs_exercises { | |
float: left; | |
border: 2px solid var(--mcs-color-dracula-pink); | |
opacity: 0.6; | |
padding: 2px 5px; | |
text-align: left; | |
text-decoration: none; | |
display: inline-block; | |
font-size: 7px; | |
font-family: "Source Code Pro", "Code New Roman", Mono, "Times New Roman", Baskervville, Inconcolata; | |
} | |
mcs_exercises_one { | |
float: left; | |
border: 2px solid var(--mcs-color-dracula-green); | |
opacity: 0.6; | |
padding: 2px 5px; | |
text-align: left; | |
display: inline-block; | |
font-size: 7px; | |
font-family: "Source Code Pro", "Code New Roman", Mono, "Times New Roman", Baskervville, Inconcolata; | |
} | |
mcs_exercises_multiple { | |
float: left; | |
border: 2px solid var(--mcs-color-dracula-red); | |
opacity: 0.6; | |
padding: 2px 5px; | |
text-align: left; | |
display: inline-block; | |
font-size: 7px; | |
font-family: "Source Code Pro", "Code New Roman", Mono, "Times New Roman", Baskervville, Inconcolata; | |
} | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made some changes in the script. look at this new version.
Now the button colors changed.
Also, using
set -euxo pipefail
makes it safer.