Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
flot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HS-public
flot
Commits
814528c3
Commit
814528c3
authored
Mar 22, 2013
by
Knut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No more jshint errors for jquery.colorhelpers.js
parent
13c71fa0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
jquery.colorhelpers.js
jquery.colorhelpers.js
+20
-14
No files found.
jquery.colorhelpers.js
View file @
814528c3
...
...
@@ -29,7 +29,7 @@
o
.
r
=
r
||
0
;
o
.
g
=
g
||
0
;
o
.
b
=
b
||
0
;
o
.
a
=
a
!=
null
?
a
:
1
;
o
.
a
=
a
!=
=
null
?
a
:
1
;
o
.
add
=
function
(
c
,
d
)
{
for
(
var
i
=
0
;
i
<
c
.
length
;
++
i
)
...
...
@@ -56,9 +56,9 @@
return
value
<
min
?
min
:
(
value
>
max
?
max
:
value
);
}
o
.
r
=
clamp
(
0
,
parseInt
(
o
.
r
),
255
);
o
.
g
=
clamp
(
0
,
parseInt
(
o
.
g
),
255
);
o
.
b
=
clamp
(
0
,
parseInt
(
o
.
b
),
255
);
o
.
r
=
clamp
(
0
,
parseInt
(
o
.
r
,
10
),
255
);
o
.
g
=
clamp
(
0
,
parseInt
(
o
.
g
,
10
),
255
);
o
.
b
=
clamp
(
0
,
parseInt
(
o
.
b
,
10
),
255
);
o
.
a
=
clamp
(
0
,
o
.
a
,
1
);
return
o
;
};
...
...
@@ -68,7 +68,7 @@
};
return
o
.
normalize
();
}
}
;
// extract CSS color property from element, going up in the DOM
// if it's "transparent"
...
...
@@ -78,7 +78,7 @@
c
=
elem
.
css
(
css
).
toLowerCase
();
// keep going until we find an element that has color, or
// we hit the body
if
(
c
!=
''
&&
c
!=
'transparent'
)
if
(
c
!=
=
''
&&
c
!=
'transparent'
)
break
;
elem
=
elem
.
parent
();
}
while
(
!
$
.
nodeName
(
elem
.
get
(
0
),
"body"
));
...
...
@@ -88,7 +88,7 @@
c
=
"transparent"
;
return
$
.
color
.
parse
(
c
);
}
}
;
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),
// returns color object, if parsing failed, you get black (0, 0,
...
...
@@ -97,27 +97,33 @@
var
res
,
m
=
$
.
color
.
make
;
// Look for rgb(num,num,num)
if
(
res
=
/rgb
\(\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*
\)
/
.
exec
(
str
))
res
=
/rgb
\(\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*
\)
/
.
exec
(
str
);
if
(
res
)
return
m
(
parseInt
(
res
[
1
],
10
),
parseInt
(
res
[
2
],
10
),
parseInt
(
res
[
3
],
10
));
// Look for rgba(num,num,num,num)
if
(
res
=
/rgba
\(\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\s
*
\)
/
.
exec
(
str
))
res
=
/rgba
\(\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]{1,3})\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\s
*
\)
/
.
exec
(
str
);
if
(
res
)
return
m
(
parseInt
(
res
[
1
],
10
),
parseInt
(
res
[
2
],
10
),
parseInt
(
res
[
3
],
10
),
parseFloat
(
res
[
4
]));
// Look for rgb(num%,num%,num%)
if
(
res
=
/rgb
\(\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*
\)
/
.
exec
(
str
))
res
=
/rgb
\(\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*
\)
/
.
exec
(
str
);
if
(
res
)
return
m
(
parseFloat
(
res
[
1
])
*
2.55
,
parseFloat
(
res
[
2
])
*
2.55
,
parseFloat
(
res
[
3
])
*
2.55
);
// Look for rgba(num%,num%,num%,num)
if
(
res
=
/rgba
\(\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\s
*
\)
/
.
exec
(
str
))
res
=
/rgba
\(\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\%\s
*,
\s
*
([
0-9
]
+
(?:\.[
0-9
]
+
)?)\s
*
\)
/
.
exec
(
str
);
if
(
res
)
return
m
(
parseFloat
(
res
[
1
])
*
2.55
,
parseFloat
(
res
[
2
])
*
2.55
,
parseFloat
(
res
[
3
])
*
2.55
,
parseFloat
(
res
[
4
]));
// Look for #a0b1c2
if
(
res
=
/#
([
a-fA-F0-9
]{2})([
a-fA-F0-9
]{2})([
a-fA-F0-9
]{2})
/
.
exec
(
str
))
res
=
/#
([
a-fA-F0-9
]{2})([
a-fA-F0-9
]{2})([
a-fA-F0-9
]{2})
/
.
exec
(
str
);
if
(
res
)
return
m
(
parseInt
(
res
[
1
],
16
),
parseInt
(
res
[
2
],
16
),
parseInt
(
res
[
3
],
16
));
// Look for #fff
if
(
res
=
/#
([
a-fA-F0-9
])([
a-fA-F0-9
])([
a-fA-F0-9
])
/
.
exec
(
str
))
res
=
/#
([
a-fA-F0-9
])([
a-fA-F0-9
])([
a-fA-F0-9
])
/
.
exec
(
str
);
if
(
res
)
return
m
(
parseInt
(
res
[
1
]
+
res
[
1
],
16
),
parseInt
(
res
[
2
]
+
res
[
2
],
16
),
parseInt
(
res
[
3
]
+
res
[
3
],
16
));
// Otherwise, we're most likely dealing with a named color
...
...
@@ -129,7 +135,7 @@
res
=
lookupColors
[
name
]
||
[
0
,
0
,
0
];
return
m
(
res
[
0
],
res
[
1
],
res
[
2
]);
}
}
}
;
var
lookupColors
=
{
aqua
:[
0
,
255
,
255
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment