Skip to content

Commit

Permalink
Update themes to be consistent with Andrew Simon's highlight. (#2341)
Browse files Browse the repository at this point in the history
Co-authored-by: dcser123 <[email protected]>
Co-authored-by: Yihui Xie <[email protected]>
  • Loading branch information
3 people authored May 23, 2024
1 parent aa34f1b commit f1788b8
Show file tree
Hide file tree
Showing 89 changed files with 179 additions and 174 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,4 @@ Collate:
'utils-vignettes.R'
'zzz.R'
RoxygenNote: 7.3.1
Remotes: yihui/highr
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- `write_bib()` now escapes all non-escaped "&" in the bibliography by default. Previously, it only escaped the title field of the package citation. You can disable the escape with the argument `tweak = FALSE` (thanks, @HedvigS #2335, @atusy #2342).

## MINOR CHANGES

- The syntax highlighting LaTeX commands for Rnw documents, `\hlstr` and `\hlstd`, were renamed to `\hlsng` and `\hldef`, respectively, to maintain consistency with Andrew Simon's highlight package (thanks, @dcser123, #2341).

# CHANGES IN knitr VERSION 1.46

## NEW FEATURES
Expand Down
2 changes: 1 addition & 1 deletion R/highlight.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ hilight_source = function(x, format, options) {

highlight_header = function() {
set_header(highlight.extra = paste(c(
sprintf('\\let\\hl%s\\hlstd', c('esc', 'pps', 'lin')),
sprintf('\\let\\hl%s\\hldef', c('esc', 'pps', 'lin')),
sprintf('\\let\\hl%s\\hlcom', c('slc', 'ppc'))
), collapse = ' '))
}
Expand Down
6 changes: 3 additions & 3 deletions R/themes.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ theme_to_header_latex = function(theme) {

# get background and foreground colors
background = css_out$background$color
foreground = css_out$std$color
foreground = css_out$def$color

# write latex highlight header
fgheader = color_def(foreground, 'fgcolor')
Expand Down Expand Up @@ -114,8 +114,8 @@ theme2list = function(theme.file) {

# mapping between CSS class and Highlight theme elements
cls2thm = c(
background = 'Canvas', num = 'Number', str = 'String', com = 'BlockComment',
opt = 'Operator', std = 'Default',
background = 'Canvas', num = 'Number', sng = 'String', com = 'BlockComment',
opt = 'Operator', def = 'Default',
kwa = 'Keyword1', kwb = 'Keyword2', kwc = 'Keyword3', kwd = 'Keyword4'
)

Expand Down
4 changes: 2 additions & 2 deletions inst/themes/acid.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
color: #800080;
font-weight: bold;
}
.str {
.sng {
color: #a68500;
}
.com {
Expand All @@ -15,7 +15,7 @@
color: #ff0080;
font-weight: bold;
}
.std {
.def {
color: #000000;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/aiseered.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #88ddee;
}
.str {
.sng {
color: #ffcc88;
}
.com {
Expand All @@ -14,7 +14,7 @@
.opt {
color: #ffcc33;
}
.std {
.def {
color: #f08080;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/andes.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #dfaf87;
}
.str {
.sng {
color: #ffff77;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #ff00cc;
}
.std {
.def {
color: #f0f0f0;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/anotherdark.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #ffa0a0;
}
.str {
.sng {
color: #ffa0a0;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #dedede;
}
.std {
.def {
color: #dedede;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/autumn.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #00884c;
}
.str {
.sng {
color: #00884c;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #404040;
}
.std {
.def {
color: #404040;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/baycomb.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #4580b4;
}
.str {
.sng {
color: #5c78f0;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #b0b0b0;
}
.std {
.def {
color: #a0b4e0;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/bclear.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #1094a0;
}
.str {
.sng {
color: #1094a0;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #323232;
}
.std {
.def {
color: #323232;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/biogoo.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #b85d00;
}
.str {
.sng {
color: #d10000;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #000000;
}
.std {
.def {
color: #000000;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/bipolar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #0083c9;
}
.str {
.sng {
color: #eba236;
}
.com {
Expand All @@ -14,7 +14,7 @@
.opt {
color: #e3d922;
}
.std {
.def {
color: #d62b9a;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/blacknblue.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #cc3366;
}
.str {
.sng {
color: #cfc631;
}
.com {
Expand All @@ -14,7 +14,7 @@
.opt {
color: #ccc6c6;
}
.std {
.def {
color: #22a0d6;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/bluegreen.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
color: #72A5E4;
font-weight: bold;
}
.str {
.sng {
color: #72A5E4;
font-weight: bold;
}
Expand All @@ -16,7 +16,7 @@
.opt {
color: #ffffff;
}
.std {
.def {
color: #ffffff;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/breeze.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #60ffff;
}
.str {
.sng {
color: #60ffff;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #ffffff;
}
.std {
.def {
color: #ffffff;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/bright.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #32ba06;
}
.str {
.sng {
color: #1861a7;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #555555;
}
.std {
.def {
color: #330066;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/camo.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #d2691e;
}
.str {
.sng {
color: #ffe4b5;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #ffe4c4;
}
.std {
.def {
color: #ffe4c4;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/candy.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #90d0ff;
}
.str {
.sng {
color: #90d0ff;
}
.com {
Expand All @@ -14,7 +14,7 @@
.opt {
color: #f0f0f8;
}
.std {
.def {
color: #f0f0f8;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/clarity.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #b3ee3a;
}
.str {
.sng {
color: #cccccc;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #b2dfee;
}
.std {
.def {
color: #b2dfee;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/dante.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #ee0000;
}
.str {
.sng {
color: #cd2626;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #cdaf96;
}
.std {
.def {
color: #cdaf96;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/darkblue.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #42cad9;
}
.str {
.sng {
color: #ffa0a0;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #bababa;
}
.std {
.def {
color: #ffffff;
}
.kwa {
Expand Down
4 changes: 2 additions & 2 deletions inst/themes/darkbone.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.num {
color: #d0e080;
}
.str {
.sng {
color: #d0e080;
}
.com {
Expand All @@ -13,7 +13,7 @@
.opt {
color: #cccccc;
}
.std {
.def {
color: #a0a0c0;
}
.kwa {
Expand Down
Loading

0 comments on commit f1788b8

Please sign in to comment.