misskey-dev / misskey

🌎 A completely free and open interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
10.12k stars 1.38k forks source link

`$[fg ]` and `$[bg ]` should allow color property in 8bpc RGBA, as well as 4bpc RGBA. #10683

Open MineCake147E opened 1 year ago

MineCake147E commented 1 year ago

💡 Summary

The $[fg ] and $[bg ] MFM tags currently allow 4bpc RGBA color.

$[fg.color=f0f9 Magenta Semitransparent]
$[bg.color=f0f9 Magenta Semitransparent]

image image The text is clearly affected by the theme behind them.

But they don't allow 8bpc RGBA color.

$[fg.color=00ff0099 Green Semitransparent]
$[bg.color=00ff0099 Green Semitransparent]

image image Not only does it appear opaque, it also appears red.

🥰 Expected Behavior

The text

$[fg.color=00ff0099 Green Semitransparent]
$[bg.color=00ff0099 Green Semitransparent]

Gets rendered identically as:

$[fg.color=0f09 Green Semitransparent]
$[bg.color=0f09 Green Semitransparent]

Like: image image

🤬 Actual Behavior

image image

📝 Steps to Reproduce

  1. Open any instance of Misskey in any browser.
  2. Type the text in the note form:
    $[fg.color=00ff0099 Green Semitransparent]
    $[bg.color=00ff0099 Green Semitransparent]
  3. View the note preview.
  4. You'll see what happens.

📌 Environment

Misskey version: 13.11.3 Your OS: Windows 10 Home 22H2 Build 19045.2846 Your browser: Mozilla Firefox 112.0.1

MineCake147E commented 1 year ago

Potential sources of this issue are: https://github.com/misskey-dev/misskey/blob/87ff004c736bef9e8d3a6ccc90242ffade977b2e/packages/frontend/src/components/mfm.ts#L232 https://github.com/misskey-dev/misskey/blob/87ff004c736bef9e8d3a6ccc90242ffade977b2e/packages/frontend/src/components/mfm.ts#L238 Which only allows hex number up to 24bit, not 32bit.