diff --git a/src/format/html/format-html-scss.ts b/src/format/html/format-html-scss.ts index 5516df9fd3c..6b783557104 100644 --- a/src/format/html/format-html-scss.ts +++ b/src/format/html/format-html-scss.ts @@ -481,6 +481,7 @@ function pandocVariablesToThemeDefaults( add(explicitVars, "font-family-base", metadata["mainfont"], asCssFont); add(explicitVars, "font-family-code", metadata["monofont"], asCssFont); add(explicitVars, "mono-background-color", metadata["monobackgroundcolor"]); + add(explicitVars, "mono-foreground-color", metadata["monoforegroundcolor"]); // Deal with sizes const explicitSizes = [ diff --git a/src/format/reveal/format-reveal-theme.ts b/src/format/reveal/format-reveal-theme.ts index ecadd81bd98..a79efa9aed4 100644 --- a/src/format/reveal/format-reveal-theme.ts +++ b/src/format/reveal/format-reveal-theme.ts @@ -278,7 +278,7 @@ function pandocVariablesToRevealDefaults( asCssNumber, ); add(explicitVars, "code-block-bg", metadata["monobackgroundcolor"]); - + add(explicitVars, "code-block-color", metadata["monoforegroundcolor"]); // Non-pandoc options from front matter add(explicitVars, "code-block-height", metadata[kCodeBlockHeight]); return explicitVars; diff --git a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss index 2aa81b39685..337f083b7e5 100644 --- a/src/resources/formats/html/bootstrap/_bootstrap-rules.scss +++ b/src/resources/formats/html/bootstrap/_bootstrap-rules.scss @@ -919,16 +919,6 @@ pre { // Maps the pandoc 'monobackgroundcolor' to bootstrap // Note this only targets code outside of sourceCode blocks -@if variable-exists(mono-background-color) { - p code:not(.sourceCode), - li code:not(.sourceCode), - kbd, - pre:not(.sourceCode), - samp { - background-color: $mono-background-color; - padding: 0.2em; - } -} p pre code:not(.sourceCode), li pre code:not(.sourceCode), @@ -937,21 +927,38 @@ pre code:not(.sourceCode) { } // Default padding if background is set +h1 code:not(.sourceCode), +h2 code:not(.sourceCode), +h3 code:not(.sourceCode), +h4 code:not(.sourceCode), +h5 code:not(.sourceCode), +h6 code:not(.sourceCode), p code:not(.sourceCode), li code:not(.sourceCode), -td code:not(.sourceCode) { +td code:not(.sourceCode), +kbd, +pre:not(.sourceCode), +samp { @if variable-exists(mono-background-color) { background-color: $mono-background-color; } @else if variable-exists(code-bg) { background-color: $code-bg; } + @if variable-exists(mono-foreground-color) { + color: $mono-foreground-color; + } @else if variable-exists(code-color) { + color: $code-color; + } + @if variable-exists(code-padding) { padding: $code-padding; } @else if variable-exists(code-bg) { padding: 0.2em; } @else if variable-exists(mono-background-color) { padding: 0.2em; + } @else if variable-exists(mono-foreground-color) { + padding: 0.2em; } } diff --git a/src/resources/formats/html/pandoc/html.styles b/src/resources/formats/html/pandoc/html.styles index 9e253e3e141..78d6beab9fc 100644 --- a/src/resources/formats/html/pandoc/html.styles +++ b/src/resources/formats/html/pandoc/html.styles @@ -107,6 +107,9 @@ code { $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: .2em .4em; +$endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ font-size: 85%; margin: 0; @@ -117,6 +120,9 @@ pre { $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: 1em; +$endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ overflow: auto; } diff --git a/src/resources/formats/html/pandoc/styles.html b/src/resources/formats/html/pandoc/styles.html index a10531a967a..a770a8c0fa6 100644 --- a/src/resources/formats/html/pandoc/styles.html +++ b/src/resources/formats/html/pandoc/styles.html @@ -119,6 +119,9 @@ $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: .2em .4em; + $endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ font-size: 85%; margin: 0; @@ -129,6 +132,9 @@ $if(monobackgroundcolor)$ background-color: $monobackgroundcolor$; padding: 1em; +$endif$ +$if(monoforegroundcolor)$ + color: $monoforegroundcolor$; $endif$ overflow: auto; } diff --git a/src/resources/schema/document-colors.yml b/src/resources/schema/document-colors.yml index a459fe6dfc0..0092edfb5b1 100644 --- a/src/resources/schema/document-colors.yml +++ b/src/resources/schema/document-colors.yml @@ -26,6 +26,12 @@ formats: [html, html4, html5, slidy, slideous, s5, dzslides] description: Sets the CSS `background-color` property on code elements and adds extra padding. +- name: monoforegroundcolor + schema: string + tags: + formats: [html, html4, html5, slidy, slideous, s5, dzslides] + description: Sets the CSS `color` property on code elements and adds extra padding. + - name: backgroundcolor schema: string tags: