sbfkcel / towxml

微信小程序HTML、Markdown渲染库
https://github.com/sbfkcel/towxml/wiki
2.47k stars 313 forks source link

theme 如何自定义 #244

Closed jeremylai7 closed 1 year ago

jeremylai7 commented 1 year ago

3.0-如何使用文档中介绍如何使用,

let result = app.towxml(`# Markdown`,'markdown',{
    base:'https://xxx.com',             // 相对资源的base路径
    theme:'dark',                   // 主题,默认`light`
    events:{                    // 为元素绑定的事件方法
        tap:(e)=>{
            console.log('tap',e);
        }
    }
});

其中的 theme [string] 可选,默认:light,用于指定主题'light'或'dark',或其它自定义

自定义是如何自定义的?

我想实现将markdown文本放入一个卡片内:

image

markdown 内的文本背景色引入卡片的背景色,不需要自定义背景色

sbfkcel commented 1 year ago

参考:https://github.com/sbfkcel/towxml/blob/master/towxml.wxss