- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个小代码笔,你可以在其中选择你喜欢的颜色来“个性化”网站......它改变了背景颜色和标题颜色(也许以后会更多),但它会将背景更改为与标题,所以标题是不可见的...我有一点 javascript 可以使十六进制颜色变亮/变暗,但这似乎不起作用。 http://codepen.io/tobiasglaus/pen/RKKdqy我试图用 class .title 使每个标题变暗。
代码
$('.title').css('color', color);
$('body').css('background', color);
我更改标题和背景颜色(我的函数称为“颜色”,所以末尾有“,颜色”。使用 $('.title').css.color = lightenDarkenColor(color, -20);
我试图使标题颜色变暗,但那里似乎有一个错误。
最佳答案
我不知道你是否解决了 jet 问题,但你可以在这里查看工作版本:Codepen
这是我添加的方法,而不是你的 lightenDarkenColor()
//@param {string} rgb "rgb(26,26,26)""
//@param {string} type "darken" or "lighten"
//@param {int} percent
//@return {string} returns the altered RGB color
function alterColor(rgb, type, percent) {
rgb = rgb.replace('rgb(', '').replace(')', '').split(',');
var red = $.trim(rgb[0]);
var green = $.trim(rgb[1]);
var blue = $.trim(rgb[2]);
//If rgb is black set it to gray
if (red == 0 && green == 0 && blue == 0) {
red = 100;
green = 100;
blue = 100;
}
if (type === "darken") {
red = parseInt(red * (100 - percent) / 100, 10);
green = parseInt(green * (100 - percent) / 100, 10);
blue = parseInt(blue * (100 - percent) / 100, 10);
} else {
red = parseInt(red * (100 + percent) / 100, 10);
green = parseInt(green * (100 + percent) / 100, 10);
blue = parseInt(blue * (100 + percent) / 100, 10);
}
rgb = 'rgb(' + red + ', ' + green + ', ' + blue + ')';
return rgb;
}
关于javascript - 加深十六进制颜色不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41758977/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!