Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ 有没有办法设置正则匹配文件夹下所有图片当作随机背景? #218

Open
cyrusmaster opened this issue Apr 10, 2024 · 1 comment
Labels
question Further information is requested

Comments

@cyrusmaster
Copy link

在什么情况下你需要该特性?In what scenarios do you need this feature?

Dark+\script\module 下的 config.js

代码如下

                random: true, // 是否随机选择自定义背景图片
                default: false, // 是否默认使用自定义背景图片
                landscape: { // 横屏背景图片
                    light: [ // 自定义亮色背景图片 URL 列表
                        null, // 纯白色背景
                        `${THEME_PATHNAME}/image/light/background-main.jpg`,
                        `${THEME_PATHNAME}/image/light/background-dialog.jpg`,
                    ],

描述可能的最优解决方案 Describe the optimal solution

我尝试 修改发现只能添加一张图片写一次
${THEME_PATHNAME}/image/light/1.jpg,
而且不能吧文件名字改成正则匹配
有什么办法可以修改 或者加在siyuan代码片段中?

描述候选的解决方案 Describe the candidate solution

No response

其他信息 Other information

No response

@Zuoqiu-Yingyi
Copy link
Owner

自定义配置可以通过创建 data/widgets/custom.js 文件实现,如下所示

/**
 * 方案一, 直接覆盖默认设置项
 */
export const config = {
    theme: {
        hotkeys: {
            style: {
                tabbar: {
                    // 覆盖默认设置项 config.theme.style.tabbar.enable
                    enable: true,
                },
            },
        },
    },
};

/**
 * 方案二, 使用回调函数覆盖默认设置项
 */
export async function callback(config) {
    // 覆盖默认设置项 config.theme.style.tabbar.enable
    config.theme.style.tabbar.enable = true;
}

@Zuoqiu-Yingyi Zuoqiu-Yingyi added the question Further information is requested label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants