文本着色的CSS等效项 [英] CSS equivalent for Text Tint

查看:132
本文介绍了文本着色的CSS等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文件从Adobe InDesign导出到基本的HTML + CSS.

I'm trying to export files from Adobe InDesign to basic HTML + CSS.

用户可以选择一些文本并更改文本颜色.使用InDesign SDK,我可以获取该颜色的RGB值,并在CSS文件中声明color: rgb(R,G,B),效果很好.

A user can select some text and change the text colour. Using the InDesign SDK I can fetch the RGB values for that colour and in the CSS file declare color: rgb(R,G,B) which works perfectly fine.

您还可以更改文本色调值.到现在为止,我只是获取色调值,将其转换为0-1范围,然后在CSS中将条目输入为color: rgba(R,G,B,Tint)

You can also change the text tint value. Upto now I was just taking the tint value, converting it to the range 0-1 and in the CSS putting an entry as color: rgba(R,G,B,Tint)

在测试过程中,我意识到tint = 0实际上应该表示白色文本,但是由于A(在RGBA中)= 0意味着透明,因此它不会显示在HTML上!

During testing I realized that tint = 0 should actually mean white text, but it didn't show on the HTML because A (in RGBA) = 0 means transparent!!!

任何人都知道如何在CSS中处理色调值吗?

Anyone knows how to handle tint values in CSS?

推荐答案

CSS中没有色彩,色调,饱和度或亮度.您应该将这些属性构建"为RGB颜色.要将色彩应用到RGB,请使用以下表达式:

There is no tint, hue,saturation or brightness in CSS. You should "build" these properties into your RGB color. To apply tint on your RGB, use this expression:

当R,G,B从0..255开始时,色调从0..1起

when R,G,B are from 0..255, tint from 0..1

new R = tint*R + (1-tint)*255;
new G = tint*G + (1-tint)*255;
new B = tint*B + (1-tint)*255;

色调是您的颜色和白色的凸组合.参见维基百科.

Tint is the convex combination of your color and white color. See Wikipedia.

这篇关于文本着色的CSS等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆