Skip to content

Commit 77da1e1

Browse files
✨ Support for custom colors
1 parent d8b604e commit 77da1e1

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ You can create a `.staartrc` file or another [Cosmiconfig](https://github.com/da
5959
| `stylePath` | Scss stylesheet path | `style.scss` |
6060
| `homePath` | Markdown file path for homepage | `README.md` |
6161
| `hostname` | Base URL for sitemap | `http://localhost:8080` |
62+
| `themeColor` | Main theme color | `#0e632c` |
63+
| `textColor` | Dark text color | `#001b01` |
64+
| `linkColor` | Hyperlink color | `#0e632c` |
65+
| `lightColor` | Light text color | `#ffffff` |
6266
| `navbar` | Array of filenames for navbar | Root files/folders in `contentDir` |
6367
| `contentFileExt` | File extension for content files | `md` |
6468
| `keepHomeHeading` | Show `h1` heading on homepage | `false` |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@staart/site",
3-
"version": "0.9.57",
3+
"version": "0.9.58",
44
"module": "dist/module.js",
55
"main": "dist/index.js",
66
"bin": "./dist/index.js",

src/generator.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ const renderScss = (styles: string) =>
6666
});
6767
});
6868
export const getCss = async () => {
69-
return await cached<string>("css", async () => {
69+
const config = await getConfig();
70+
return (await cached<string>("css", async () => {
7071
try {
7172
return await renderScss(
7273
(await readFile(await getStylePath())).toString()
@@ -76,7 +77,20 @@ export const getCss = async () => {
7677
(await readFile(join(__dirname, "..", "src", "style.scss"))).toString()
7778
);
7879
}
79-
});
80+
}))
81+
.replace("$theme: #0e632c", `$theme: ${config.themeColor || "#0e632c"};`)
82+
.replace(
83+
"$text-color: #001b01",
84+
`$text-color: ${config.textColor || "#001b01"};`
85+
)
86+
.replace(
87+
"$link-color: #0e632c",
88+
`$link-color: ${config.linkColor || "#0e632c"};`
89+
)
90+
.replace(
91+
"$light-color: #fff",
92+
`$light-color: ${config.lightColor || "#fff"};`
93+
);
8094
};
8195

8296
export const generate = async () => {

src/interfaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export interface StaartSiteConfig {
2020
noHome?: boolean;
2121
noSitemap?: boolean;
2222
noContentList?: boolean;
23+
themeColor?: string;
24+
textColor?: string;
25+
linkColor?: string;
26+
lightColor?: string;
2327
[index: string]: any;
2428
}
2529

0 commit comments

Comments
 (0)