瀏覽代碼

Merge pull request #15 from digitalcraftsman/change-theme-in-configs-globally

Added an option change the theme globally in the configs
digitalcraftsman 9 年之前
父節點
當前提交
cd672f87b7
共有 4 個文件被更改,包括 17 次插入8 次删除
  1. 14
    5
      README.md
  2. 1
    1
      layouts/_default/list.html
  3. 1
    1
      layouts/_default/single.html
  4. 1
    1
      layouts/index.html

+ 14
- 5
README.md 查看文件

@@ -60,12 +60,21 @@ There are eight themes available at this time.
60 60
 
61 61
 ![Hyde theme classes](https://f.cloud.github.com/assets/98681/1817044/e5b0ec06-6f68-11e3-83d7-acd1942797a1.png)
62 62
 
63
-To use a theme, add anyone of the available theme classes to the `<body>` element in the `default.html` layout, like so:
63
+To use a theme, add the `themeColor` variable under `params``, like so:
64 64
 
65
-```html
66
-<body class="theme-base-08">
67
-  ...
68
-</body>
65
+**TOML**
66
+```toml
67
+theme = "hyde"
68
+
69
+[params]
70
+  themeColor = "theme-base-09"
71
+```
72
+
73
+**YAML**
74
+```
75
+theme: "hyde"
76
+params:
77
+  themeColor: "theme-base-09"
69 78
 ```
70 79
 
71 80
 To create your own theme, look to the Themes section of [included CSS file](https://github.com/poole/hyde/blob/master/public/css/hyde.css). Copy any existing theme (they're only a few lines of CSS), rename it, and change the provided colors.

+ 1
- 1
layouts/_default/list.html 查看文件

@@ -1,5 +1,5 @@
1 1
 {{ partial "head.html" . }}
2
-<body>
2
+<body class="{{ .Site.Params.themeColor }}">
3 3
 
4 4
 {{ partial "sidebar.html" . }}
5 5
 

+ 1
- 1
layouts/_default/single.html 查看文件

@@ -1,5 +1,5 @@
1 1
 {{ partial "head.html" . }}
2
-<body>
2
+<body class="{{ .Site.Params.themeColor }}">
3 3
 
4 4
 {{ partial "sidebar.html" . }}
5 5
 

+ 1
- 1
layouts/index.html 查看文件

@@ -1,5 +1,5 @@
1 1
 {{ partial "head.html" . }}
2
-<body>
2
+<body class="{{ .Site.Params.themeColor }}">
3 3
 
4 4
 {{ partial "sidebar.html" . }}
5 5