Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Dashboards
Tabler
提交
32d7e0e1
T
Tabler
项目概览
Dashboards
/
Tabler
11 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
32d7e0e1
编写于
11月 30, 2020
作者:
C
codecalm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
colors fixes
上级
bdf49955
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
162 addition
and
19 deletion
+162
-19
src/pages/colors.html
src/pages/colors.html
+136
-0
src/scss/_variables.scss
src/scss/_variables.scss
+14
-15
src/scss/mixins/_functions.scss
src/scss/mixins/_functions.scss
+1
-1
src/scss/ui/_avatars.scss
src/scss/ui/_avatars.scss
+1
-1
src/scss/ui/_tables.scss
src/scss/ui/_tables.scss
+8
-0
src/scss/utils/_colors.scss
src/scss/utils/_colors.scss
+2
-2
未找到文件。
src/pages/colors.html
0 → 100644
浏览文件 @
32d7e0e1
---
title: Colors
page-header: Colors
---
{% assign colors = '' | split: '' %}
{% for color in site.colors %}
{% assign colors = colors | push: color[0] %}
{% endfor %}
{% assign colors = colors | push: 'dark' %}
{% assign colors = colors | push: 'muted' %}
<div
class=
"card"
>
<div
class=
"card-body"
>
<div
class=
"table-responsive"
>
<table
class=
"table text-center"
>
<tr>
{% for color in colors %}
<td>
<div
class=
"avatar text-{% if color == 'white' %}dark{% else %}white{% endif %} bg-{{ color }}"
data-demo-color
>
{{ color | slice: 0, 2 }}
</div>
</td>
{% endfor %}
</tr>
<tr>
{% for color in colors %}
<td>
<div
class=
"avatar bg-{{ color }}-lt"
data-demo-color
>
{{ color | slice: 0, 2 }}
</div>
</td>
{% endfor %}
</tr>
<tr>
{% for color in colors %}
<td>
<div
class=
"avatar text-{{ color }} bg-white"
data-demo-color
>
{{ color | slice: 0, 2 }}
</div>
</td>
{% endfor %}
</tr>
<tr
class=
"bg-light"
>
{% for color in colors %}
<td>
<div
class=
"avatar text-{{ color }} bg-light"
data-demo-color
>
{{ color | slice: 0, 2 }}
</div>
</td>
{% endfor %}
</tr>
<tr
class=
"bg-dark text-white"
>
{% for color in colors %}
<td>
{% if color == 'dark' %}{% assign c = 'white' %}{% else %}{% assign c = color %}{% endif %}
<div
class=
"avatar text-{{ c }} bg-dark"
data-demo-color
>
{{ c | slice: 0, 2 }}
</div>
</td>
{% endfor %}
</tr>
<tr
class=
"bg-dark text-white"
>
{% for color in colors %}
<td>
{% if color == 'dark' %}{% assign c = 'white' %}{% else %}{% assign c = color %}{% endif %}
<div
class=
"avatar bg-{{ c }}-lt"
data-demo-color
>
{{ c | slice: 0, 2 }}
</div>
<div
class=
"mt-2"
data-demo-color-contrast
></div>
</td>
{% endfor %}
</tr>
</table>
</div>
</div>
</div>
{% comment %}
{% capture_once scripts %}
<script>
var
colorChannelMixer
=
function
(
colorChannelA
,
colorChannelB
,
amountToMix
)
{
var
channelA
=
colorChannelA
*
amountToMix
;
var
channelB
=
colorChannelB
*
(
1
-
amountToMix
);
return
parseInt
(
channelA
+
channelB
);
};
var
color2Rgb
=
function
(
color
)
{
var
resultHex
=
/^#
?([
a-f
\d]{2})([
a-f
\d]{2})([
a-f
\d]{2})
$/i
.
exec
(
color
);
if
(
resultHex
)
{
return
[
parseInt
(
resultHex
[
1
],
16
),
parseInt
(
resultHex
[
2
],
16
),
parseInt
(
resultHex
[
3
],
16
)
]
}
var
resultRgb
=
/^rgba
?\((\d
+
)
,
\s?(\d
+
)
,
\s?(\d
+
)(?:
,
\s?([\d
.
]
+
))?\)
$/i
.
exec
(
color
);
if
(
resultRgb
)
{
var
alpha
=
resultRgb
[
4
]
?
(
parseFloat
(
resultRgb
[
4
]))
:
1
;
return
[
colorChannelMixer
(
resultRgb
[
1
],
255
,
alpha
),
colorChannelMixer
(
resultRgb
[
2
],
255
,
alpha
),
colorChannelMixer
(
resultRgb
[
3
],
255
,
alpha
)
]
}
return
null
;
};
var
getLuminanace
=
(
values
)
=>
{
const
rgb
=
values
.
map
((
v
)
=>
{
var
val
=
v
/
255
;
return
val
<=
0.03928
?
val
/
12.92
:
((
val
+
0.055
)
/
1.055
)
**
2.4
;
});
return
Number
((
0.2126
*
rgb
[
0
]
+
0.7152
*
rgb
[
1
]
+
0.0722
*
rgb
[
2
]).
toFixed
(
3
));
};
var
getContrastRatio
=
(
colorA
,
colorB
)
=>
{
var
lumA
=
getLuminanace
(
color2Rgb
(
colorA
)),
lumB
=
getLuminanace
(
color2Rgb
(
colorB
));
console
.
log
(
'
colorA, colorB, color2Rgb(colorA), color2Rgb(colorB)
'
,
colorA
,
colorB
,
color2Rgb
(
colorA
),
color2Rgb
(
colorB
));
return
Math
.
round
((
Math
.
max
(
lumA
,
lumB
)
+
0.05
)
/
(
Math
.
min
(
lumA
,
lumB
)
+
0.05
)
*
100
)
/
100
;
};
(
function
()
{
const
elements
=
document
.
querySelectorAll
(
'
[data-demo-color]
'
);
if
(
elements
.
length
)
{
elements
.
forEach
(
function
(
element
)
{
var
{
color
,
backgroundColor
}
=
window
.
getComputedStyle
(
element
),
elementRatio
=
element
.
parentElement
.
querySelector
(
'
[data-demo-color-contrast]
'
),
ratio
=
getContrastRatio
(
color
,
backgroundColor
);
elementRatio
.
innerHTML
=
ratio
;
elementRatio
.
classList
.
add
(
ratio
>
4.5
?
'
text-green
'
:
'
text-red
'
);
});
}
})();
</script>
{% endcapture_once %}
{% endcomment %}
\ No newline at end of file
src/scss/_variables.scss
浏览文件 @
32d7e0e1
...
...
@@ -113,27 +113,27 @@ $gray-900: $dark !default;
$blue
:
#206bc4
!
default
;
$azure
:
#4299e1
!
default
;
$indigo
:
#
6574cd
!
default
;
$purple
:
#
9f7aea
!
default
;
$pink
:
#
ed64a6
!
default
;
$red
:
#
e53e3e
!
default
;
$orange
:
#
ed8936
!
default
;
$yellow
:
#f
ab005
!
default
;
$lime
:
#
82c91e
!
default
;
$green
:
#
5eba00
!
default
;
$teal
:
#
2bcbba
!
default
;
$indigo
:
#
4263eb
!
default
;
$purple
:
#
ae3ec9
!
default
;
$pink
:
#
d6336c
!
default
;
$red
:
#
d63939
!
default
;
$orange
:
#
f76707
!
default
;
$yellow
:
#f
59f00
!
default
;
$lime
:
#
74b816
!
default
;
$green
:
#
2fb344
!
default
;
$teal
:
#
0ca678
!
default
;
$cyan
:
#17a2b8
!
default
;
$black
:
#000000
!
default
;
$white
:
#ffffff
!
default
;
$text-muted
:
mix
(
$body-color
,
#fff
,
percentage
(
$text-muted-opacity
))
!
default
;
$text-muted-light
:
mix
(
$body-color
,
#fff
,
percentage
(
$text-muted-light-opacity
))
!
default
;
$text-muted-dark
:
mix
(
$body-color
,
#fff
,
percentage
(
$text-muted-dark-opacity
))
!
default
;
$text-muted
:
mix
(
$body-color
,
#fff
fff
,
percentage
(
$text-muted-opacity
))
!
default
;
$text-muted-light
:
mix
(
$body-color
,
#fff
fff
,
percentage
(
$text-muted-light-opacity
))
!
default
;
$text-muted-dark
:
mix
(
$body-color
,
#fff
fff
,
percentage
(
$text-muted-dark-opacity
))
!
default
;
$border-color
:
mix
(
$text-muted
,
#fff
,
percentage
(
$border-opacity
))
!
default
;
$border-color
:
mix
(
$text-muted
,
#fff
fff
,
percentage
(
$border-opacity
))
!
default
;
$border-color-transparent
:
rgba
(
$text-muted
,
$border-opacity
)
!
default
;
$border-color-dark
:
mix
(
$text-muted
,
#fff
,
percentage
(
$border-dark-opacity
))
!
default
;
$border-color-dark
:
mix
(
$text-muted
,
#fff
fff
,
percentage
(
$border-dark-opacity
))
!
default
;
$border-color-dark-transparent
:
rgba
(
$text-muted
,
$border-dark-opacity
)
!
default
;
$active-bg
:
rgba
(
$blue
,
.06
)
!
default
;
...
...
@@ -351,7 +351,6 @@ $dropdown-link-active-color: $primary !default;
$dropdown-link-active-bg
:
$active-bg
!
default
;
//loader
$loader-size
:
2
.5rem
!
default
;
...
...
src/scss/mixins/_functions.scss
浏览文件 @
32d7e0e1
...
...
@@ -11,7 +11,7 @@
}
@function
theme-color-darker
(
$color
)
{
@return
shade-color
(
$color
,
1
6
%
);
@return
shade-color
(
$color
,
1
0
%
);
}
@function
str-replace
(
$string
,
$search
,
$replace
:
""
)
{
...
...
src/scss/ui/_avatars.scss
浏览文件 @
32d7e0e1
...
...
@@ -4,7 +4,7 @@
width
:
var
(
--
#{
$variable-prefix
}
avatar-size
);
height
:
var
(
--
#{
$variable-prefix
}
avatar-size
);
font-size
:
calc
(
var
(
--
#{
$variable-prefix
}
avatar-size
)
/
#{
$line-height-base
*
2
}
);
font-weight
:
$font-weight-
normal
;
font-weight
:
$font-weight-
medium
;
display
:
inline-flex
;
align-items
:
center
;
justify-content
:
center
;
...
...
src/scss/ui/_tables.scss
浏览文件 @
32d7e0e1
...
...
@@ -14,6 +14,14 @@
}
}
.table-responsive
{
margin-bottom
:
$spacer
;
.table
{
margin-bottom
:
0
;
}
}
.table-transparent
{
thead
{
th
{
...
...
src/scss/utils/_colors.scss
浏览文件 @
32d7e0e1
...
...
@@ -16,7 +16,7 @@ SOCIAL COLORS
@if
$enable-extra-colors
{
@each
$color
,
$value
in
$colors
{
@each
$color
,
$value
in
map-merge
(
$colors
,
(
dark
:
$dark
,
muted
:
$text-muted
,
white
:
$white
))
{
.bg-
#{
$color
}
{
background
:
$value
;
}
...
...
@@ -26,7 +26,7 @@ SOCIAL COLORS
}
.bg-
#{
$color
}
-lt
{
color
:
$value
!
important
;
color
:
theme-color-darker
(
$value
)
!
important
;
background
:
theme-color-lighter
(
$value
,
true
)
!
important
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录