asasugar / HPRichText

hp-richtext, 是一个适用于 HarmonyOS Next 的富文本解析组件。
Apache License 2.0
40 stars 3 forks source link

字体颜色渲染还是有问题 #47

Closed badboy-tian closed 1 month ago

badboy-tian commented 1 month ago

我把你源码clone下来, 然后跑标签

@State richTextOption: RichTextOption = {
    baseFontSize: 15,
    baseFontColor: "#99000000",
    content: `
    <span style='text-align:center;'>您好, 现在会员促销期间<font color='red'>打6折</font>哟~错过时间<font color='red'>恢复原价</font>哈!</span>
       `,
    imageProp: {
      webp: true,
    }
  };

效果如图

image

感觉是font标签后面的字颜色都变黑了, 设置baseFontColor失效了. font标签之前的字是black90的颜色 淡黑色

badboy-tian commented 1 month ago
[{
    "node": "element",
    "attr": {},
    "tag": "span",
    "tagType": "inline",
    "artUIStyleObject": {
        "fontSize": 15,
        "fontColor": "#99000000",
        "textAlign": 1
    },
    "nodes": [{
        "node": "text",
        "text": "您好, 现在会员促销期间"
    }, {
        "node": "element",
        "attr": {
            "color": "red"
        },
        "tag": "font",
        "tagType": "inline",
        "artUIStyleObject": {
            "fontSize": 15,
            "fontColor": "red",
            "textAlign": 1,
            "border": {},
            "margin": {},
            "padding": {}
        },
        "nodes": [{
            "node": "text",
            "text": "打6折"
        }, {
            "node": "text",
            "text": "哟~错过时间"
        }, {
            "node": "element",
            "attr": {
                "color": "red"
            },
            "tag": "font",
            "tagType": "inline",
            "artUIStyleObject": {
                "fontSize": 15,
                "fontColor": "red",
                "textAlign": 1,
                "border": {},
                "margin": {},
                "padding": {}
            },
            "nodes": [{
                "node": "text",
                "text": "恢复原价"
            }],
            "isInlinePushNode": true
        }, {
            "node": "text",
            "text": "哈!"
        }],
        "isInlinePushNode": true
    }],
    "addHarmonyTextTag": true
}]

解析后的数据中, 有点没看懂

{
            "node": "text",
            "text": "打6折"
        }, {
            "node": "text",
            "text": "哟~错过时间"
        }

这2个都是没有其他属性标签, 你怎么确认的打6折是红色, "哟~错过时间"是黑色, 而不是black90颜色?

badboy-tian commented 1 month ago

你好 请问有后文么

asasugar commented 1 month ago

参考 Example_14.ets

badboy-tian commented 1 month ago

一模一样的代码 还是不行啊 image

badboy-tian commented 1 month ago

哦 需要新版本哈 这个发布新版本需要多久 才能用ohpm下载更新呢