Skip to content

Commit

Permalink
Add option to change content font color (#286)
Browse files Browse the repository at this point in the history
Co-authored-by: Regis Philibert <login@regisphilibert.com>
  • Loading branch information
mountainbug95 and regisphilibert authored Dec 23, 2021
1 parent f078a2b commit 3b30dfb
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 10 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,22 @@ You can replace the title of your site in the top left corner of each page with
site_logo = "img/logo.svg"
```

### Set Content Font Color

You can set the font color of the main content both globally and on individual pages:

Globally:
Set the `text_color` param in the `config.toml` file.
```
[params]
text_color = "green"
```
Individual Page (prioritized over global):
Set the `text_color` param in a page's markdown file front matter.
note: The value of `text_color` must be a valid tachyons color class. Alist can be found [here](http://tachyons.io/docs/themes/skins/).
### Localize date format
Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enableRobotsTXT = true
filename = "sitemap.xml"

[params]
text_color = ""
author = ""
favicon = ""
site_logo = ""
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "main" }}
<article class="pa3 pa4-ns nested-copy-line-height nested-img">
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
{{- .Content -}}
</section>
<section class="flex-ns flex-wrap justify-around mt5">
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1 class="f1 athelas mt3 mb1">
<span class="f6 mv4 dib tracked"> - {{ i18n "wordCount" .WordCount }} </span>
{{ end }}
</header>
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f4 nested-links nested-img mid-gray pr4-l w-two-thirds-l">
<div class="nested-copy-line-height lh-copy {{ $.Param "post_content_classes" | default "serif"}} f4 nested-links nested-img {{ $.Param "text_color" | default "mid-gray" }} pr4-l w-two-thirds-l">
{{- .Content -}}
{{- partial "tags.html" . -}}
<div class="mt6 instapaper_ignoref">
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/taxonomy.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ define "main" }}
<article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img mid-gray">
<p>{{i18n "taxonomyPageList" .}}</p>
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img {{ $.Param "text_color" | default "mid-gray" }}">
<p>Below you will find pages that utilize the taxonomy term “{{ .Title }}”</p>
</div>
</article>
<div class="mw8 center">
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/terms.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ define "main" }}
{{ $data := .Data }}
<article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img mid-gray">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img {{ $.Param "text_color" | default "mid-gray" }}">
{{ .Content }}
</div>
</article>
Expand Down
3 changes: 1 addition & 2 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{ define "main" }}

<article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
<article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
{{ .Content }}
</article>
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/page/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1 class="f1">
{{ .Title }}
</h1>
</header>
<div class="nested-copy-line-height lh-copy f4 nested-links nested-img mid-gray">
<div class="nested-copy-line-height lh-copy f4 nested-links nested-img {{ $.Param "text_color" | default "mid-gray" }}">
{{ .Content }}
</div>
</article>
Expand Down
2 changes: 1 addition & 1 deletion layouts/post/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This template is the same as the default and is here to demonstrate that if you have a content directory called "post" you can create a layouts directory, just for that section.
*/}}
<article class="pa3 pa4-ns nested-copy-line-height nested-img">
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
{{ .Content }}
</section>
<aside class="flex-ns flex-wrap justify-around mt5">
Expand Down
2 changes: 1 addition & 1 deletion layouts/post/summary.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="mb3 pa4 mid-gray overflow-hidden">
<div class="mb3 pa4 {{ $.Param "text_color" | default "mid-gray" }} overflow-hidden">
{{ if .Date }}
<div class="f6">
{{ .Date.Format (default "January 2, 2006" .Site.Params.date_format) }}
Expand Down

0 comments on commit 3b30dfb

Please sign in to comment.