forked from 0x2620/oxjs
make Ox.rgb always return integers
This commit is contained in:
parent
fa84921333
commit
d29bc5569b
4 changed files with 9 additions and 25 deletions
|
|
@ -29,21 +29,13 @@ Ox.Theme = (function() {
|
|||
function renderElement(value, type) {
|
||||
var $element, background, color, lightness = that[getTheme()].lightness;
|
||||
if (type == 'hue') {
|
||||
background = Ox.rgb(value, 1, lightness.background).map(function(value) {
|
||||
return Math.round(value);
|
||||
});
|
||||
color = Ox.rgb(value, 1, lightness.color).map(function(value) {
|
||||
return Math.round(value);
|
||||
});
|
||||
background = Ox.rgb(value, 1, lightness.background);
|
||||
color = Ox.rgb(value, 1, lightness.color);
|
||||
} else if (type == 'saturation') {
|
||||
background = Ox.range(7).map(function(i) {
|
||||
return Ox.rgb(i * 60, value, lightness.background).map(function(value) {
|
||||
return Math.round(value);
|
||||
});
|
||||
});
|
||||
color = Ox.rgb(0, 0, lightness.color).map(function(value) {
|
||||
return Math.round(value);
|
||||
return Ox.rgb(i * 60, value, lightness.background);
|
||||
});
|
||||
color = Ox.rgb(0, 0, lightness.color);
|
||||
} else if (type == 'lightness') {
|
||||
background = Ox.range(3).map(function() {
|
||||
return Math.round(value * 255);
|
||||
|
|
@ -54,12 +46,10 @@ Ox.Theme = (function() {
|
|||
} else if (type == 'gradient') {
|
||||
background = Ox.range(2).map(function(i) {
|
||||
return Ox.rgb(value, 1, lightness.background).map(function(value) {
|
||||
return Math.round(value + (i == 0 ? 16 : -16));
|
||||
return value + (i == 0 ? 16 : -16);
|
||||
});
|
||||
});
|
||||
color = Ox.rgb(value, 1, lightness.color).map(function(value) {
|
||||
return Math.round(value);
|
||||
});
|
||||
color = Ox.rgb(value, 1, lightness.color);
|
||||
}
|
||||
$element = $('<div>')
|
||||
.addClass(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue