Skip to content

Commit

Permalink
add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
xishang0128 committed Sep 11, 2024
1 parent a866559 commit 7f47d40
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default defineConfig({
},
{
label: '使用教程', items: [
'guides/function/icon',
{
label: '覆写', items: [
'guides/function/override/overview',
Expand Down
54 changes: 54 additions & 0 deletions src/content/docs/guides/function/icon.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: 策略组图标
---

import { Tabs, TabItem } from '@astrojs/starlight/components';

配置策略组中的 [icon](https://wiki.metacubex.one/config/proxy-groups/#icon) 字段,支持 `http`/`base64`/`svg`

:::tip[关于 GLOBAL 组]
`GLOBAL`策略组也可以在配置文件中自定义

但 web 面板以及部分客户端使用`GLOBAL`策略组内的 策略组顺序 进行排序

建议在自定义`GLOBAL`策略组时,书写完整当前配置所有的策略组 (除了 GLOBAL 本身)
:::

<Tabs>
<TabItem label="http">

```yaml
proxy-groups:
- name: xxx
icon: https://xxx.xxx/icon.png
...
```

</TabItem>
<TabItem label="base64">

```yaml
proxy-groups:
- name: xxx
icon: 'data:image/svg+xml;base64,xxxx'
...
```

</TabItem>
<TabItem label="svg">

使用 svg 文件的内容时需要对引号进行转义

```yaml
proxy-groups:
- name: xxx
icon: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\" width=\"48px\" height=\"48px\"><path fill=\"#fbc02d\"
d=\"M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12 s5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24s8.955,20,20,20 s20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z\" /><path fill=\"#e53935\"
d=\"M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039 l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z\" /><path fill=\"#4caf50\"
d=\"M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36 c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z\" /><path fill=\"#1565c0\"
d=\"M43.611,20.083L43.595,20L42,20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571 c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z\" /></svg>"
...
```

</TabItem>
</Tabs>
4 changes: 2 additions & 2 deletions src/content/docs/guides/function/override/yaml.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';

如果目标是是简单值,将直接覆盖

如果遇到嵌套的对象,函数会进一步递归合并这些嵌套的对象, 可以使用 `!` 修饰以强制覆盖整个对象而不是递归合并
如果遇到嵌套的对象,函数会进一步递归合并这些嵌套的对象可以使用 `!` 修饰以强制覆盖整个对象而不是递归合并

如:
```yaml
# 直接覆盖配置中的dns字段为以下内容而不进行合并
# 直接覆盖配置中的 dns 字段为以下内容而不进行合并
dns!:
enable: false
```
Expand Down

0 comments on commit 7f47d40

Please sign in to comment.