【问题标题】:php HSL color scheme : Making a legendphp HSL配色方案:制作图例
【发布时间】:2012-05-06 02:42:17
【问题描述】:

好的,所以我创建了一个配色方案,以突出显示输入数据(文本)的某些部分。

但是我需要制作一个 Legend 来告诉用户每种颜色的含义。这是我到目前为止所拥有的: ` /输入/

<div style="text-color: hsl($col,35%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,45%, 50%);">/*input*/</div>

<div style="text-color: hsl($col,50%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,55%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,60%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,70%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,80%, 100%);">/*input*/</div>

    <div style="text-color: hsl($col,90%, 100%);">/*input*/</div>

<div style="text-color: hsl($col,100%, 100%);">/*input*/</div>      

` 其中 input- 将是颜色的标签,例如这意味着强大的结果。 $col 是一个变量,每次都会改变颜色,例如0 = 红色等。

我需要知道如何将我在这里的颜色变成一个图例,它位于一个 html 页面上。

有什么帮助吗?

谢谢:)

【问题讨论】:

  • 我已经阅读了三遍,但没有理解您的问题。您是在问如何替换字符串中的变量或如何获取颜色值?请更具体。另请注意,IE

标签: php html css colors hsl


【解决方案1】:

我猜你正试图用颜色的实际名称替换你的 /input/ 占位符,即栗色、黑色、黄色等。 您可能最终会编写自己的替换代码。颜色名称可在此处http://www.imagemagick.org/script/color.php 或此处http://www.w3schools.com/cssref/css_colornames.asp 获得。 如果你有 ImageMagick,你可以创建单像素图像并使用 http://www.php.net/manual/en/imagickpixel.getcolorasstring.php 来检索颜色名称,据我所知 - 你应该缓存结果,不过...... 我不知道任何其他内置函数,但您可以检查一些类存储库,如 phpclasses.org。

希望对您有所帮助, 斯蒂芬

【讨论】:

    猜你喜欢
    • 2018-05-29
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-24
    • 1970-01-01
    • 2021-02-02
    相关资源
    最近更新 更多