Skip to content

Commit

Permalink
feat: add theme styles
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Apr 13, 2023
1 parent 6d1eefc commit 107c839
Show file tree
Hide file tree
Showing 33 changed files with 2,233 additions and 13 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: ci

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Build for production
run: pnpm build
3 changes: 3 additions & 0 deletions apps/zhi-core/esbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import path from "path"
import minimist from "minimist"
import { copy } from "esbuild-plugin-copy"
import { dtsPlugin } from "esbuild-plugin-d.ts"
import stylePlugin from "esbuild-style-plugin"

const args = minimist(process.argv.slice(2))
const isWatch = args.watch || args.w
Expand Down Expand Up @@ -64,5 +65,7 @@ export const esbuildConfig: BuildOptions = {
],
watch: true,
}),

stylePlugin(),
],
}
6 changes: 4 additions & 2 deletions apps/zhi-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
"devDependencies": {
"@types/minimist": "^1.2.2",
"@types/node": "^18.15.11",
"api-docs": "workspace:*",
"esbuild": "^0.16.9",
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-d.ts": "^1.1.0",
"esbuild-style-plugin": "^1.6.1",
"eslint-config-custom": "workspace:*",
"minimist": "^1.2.8",
"stylus": "^0.59.0",
"ts-node": "^10.9.1",
"tsconfig": "workspace:*",
"api-docs": "workspace:*"
"tsconfig": "workspace:*"
}
}
6 changes: 5 additions & 1 deletion apps/zhi-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@

import Zhi from "./theme/zhi"

// 主题样式注入入口
import "./style/common/fonts/webfont.css"
import "./style/index.styl"

/**
* 主题入口,由思源笔记自动调用
*/
;(async () => {
// const common = ZhiUtil.zhiCommon()

const zhi = new Zhi()
console.log("hello, zhi theme", zhi)
console.log("hello, zhi theme2345", zhi)
// const zhi = new Zhi(common.deviceUtil.getDevice())
// await zhi.init()
})()
Expand Down
39 changes: 39 additions & 0 deletions apps/zhi-core/src/style/common/basic/basic-dark.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

// -------------------------------------------------颜色定义-暗黑模式---------------------------------------------------
html[data-theme-mode="dark"]
--zhi-body-bg _body-bg-dark
--zhi-main-bg _main-bg-dark
--zhi-sidebar-bg _sidebar-bg-dark
// --zhi-blur-bg _blur-bg-dark
// --zhi-custom-block-bg _custom-block-bg-dark
--zhi-primary-color _primary-color-dark
--zhi-text-color _text-color-dark
// --zhi-text-lighten-color _text-lighten-color-dark
--zhi-border-color _border-color-dark
// --zhi-code-bg _code-bg-dark
// --zhi-code-color _code-color-dark
--zhi-list-hover _list-hover-dark
39 changes: 39 additions & 0 deletions apps/zhi-core/src/style/common/basic/basic-green.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

// -------------------------------------------------颜色定义-阅读模式---------------------------------------------------
html[data-theme-mode="green"]
--zhi-body-bg _body-bg-green
--zhi-main-bg _main-bg-green
--zhi-sidebar-bg _sidebar-bg-green
// --zhi-blur-bg _blur-bg-green
// --zhi-custom-block-bg _custom-block-bg-green
--zhi-primary-color _primary-color-green
--zhi-text-color _text-color-green
// --zhi-text-lighten-color: _text-lighten-color-green
--zhi-border-color _border-color-green
// --zhi-code-bg _code-bg-green
// --zhi-code-color _code-color-green
--zhi-list-hover _list-hover-green
39 changes: 39 additions & 0 deletions apps/zhi-core/src/style/common/basic/basic-light.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

// -------------------------------------------------颜色定义-浅色模式---------------------------------------------------
html[data-theme-mode="light"]
--zhi-body-bg _body-bg-light
--zhi-main-bg _main-bg-light
--zhi-sidebar-bg _sidebar-bg-light
// --zhi-blur-bg _blur-bg-light
// --zhi-custom-block-bg _custom-block-bg-light
--zhi-primary-color _primary-color-light
--zhi-text-color _text-color-light
// --zhi-text-lighten-color _text-lighten-color-light
--zhi-border-color _border-color-light
// --zhi-code-bg _code-bg-light
// --zhi-code-color _code-color-light
--zhi-list-hover _list-hover-light
34 changes: 34 additions & 0 deletions apps/zhi-core/src/style/common/basic/index.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

@require "basic-light"
@require "basic-dark"
@require "basic-green"

// 基础样式
:root
--zhi-font-family _font-family-mono
--zhi-font-family-code _font-family-mono
--zhi-border-radius-round _border-radius-round
3 changes: 3 additions & 0 deletions apps/zhi-core/src/style/common/fonts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Notice

DO NOT include webfont.css in any .styl file, do import it in js entry file!
27 changes: 27 additions & 0 deletions apps/zhi-core/src/style/common/fonts/font.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

// 字体定义
// webfont已经引用 LXGW 和 opensans ,这里还是可以在定义其他字体
26 changes: 26 additions & 0 deletions apps/zhi-core/src/style/common/fonts/index.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

@require "./font"
Loading

0 comments on commit 107c839

Please sign in to comment.