允许在颜色文本输入框中粘贴带有前导#的十六进制颜色字符串(主题定制)」}

(不确定这应被视为 bug 还是用户体验问题)

您好,

在电脑上操作十六进制颜色值时,您经常从剪贴板复制带有前导 # 的十六进制值并粘贴。
例如,将 #1a2331 粘贴到颜色文本输入框时,会出现一个小问题:
首先,由于输入框限制为六个字符,而 #1a2331 因包含 # 共有七个字符,因此字符串的最后一个字符会被移除。
随后,# 会从字符串中自动剥离。
因此,粘贴后输入框中的最终值变为:1a233,缺少了最后一个字符 1,导致颜色值错误。

一种解决方案是:在检查字符串字符数之前,先移除 #

要复现此问题,请在 Discourse 颜色主题自定义的任何颜色文本输入框中粘贴字符串 #1a2331

我使用的是 Windows 10 和 Chrome 浏览器,Discourse 版本为 2.4.0.beta7。

2 个赞

Since I can remember the insertion of the hexadecimal codes in the Discourse palette has always been exactly as you described it. You must manually enter only the hexadecimal number and omit #

Many color pickers give you the option of copying the hexadecimal code by previously deciding the code format
image

2 个赞

Sure I get this, it’s just that this behavior is a bit odd. I had to check the value I was coping pasting a couple times before noticing that the last number of my string was missing in the input. I didn’t understand why the value was invalid at first and I guess this specific copy paste behavior could be improved with no drawback.

5 个赞

这仍然是个问题。

但很多都没有!

如果 Discourse 在将颜色粘贴到各种设置时自动处理前面的 #,那将是一种非常好的润色。

1 个赞