Skip to content

Commit

Permalink
0.701
Browse files Browse the repository at this point in the history
  • Loading branch information
solstice23 committed Jan 23, 2020
1 parent 122047e commit 7209d29
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 61 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Argon 使用 [GPL V3.0](https://github.com/abc2237512422/argon-theme/blob/master

# 更新日志

## 20200123 v0.701
+ 修复不显示自定义主题色选择器时 js 的执行错误

## 20200123 v0.700
+ 增加前端自定义主题色功能(用户在浮动操作按钮博客设置菜单中可自定义主题色)
+ 问题修复
Expand Down
117 changes: 59 additions & 58 deletions argontheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,65 +911,66 @@ function hex2str(hex){
return rgb2str(hex2rgb(hex));
}
//颜色选择器 & 切换主题色
let themeColorPicker = new Pickr({
el: '#theme-color-picker',
container: 'body',
theme: 'monolith',
closeOnScroll: false,
appClass: 'theme-color-picker-box',
useAsButton: false,
padding: 8,
inline: false,
autoReposition: true,
sliders: 'h',
disabled: false,
lockOpacity: true,
outputPrecision: 0,
comparison: false,
default: $("meta[name='theme-color']").attr("content"),
swatches: ['#5e72e4', '#fa7298', '#009688', '#607d8b', '#2196f3', '#3f51b5', '#ff9700', '#109d58', '#dc4437', '#673bb7', '#212121', '#795547'],
defaultRepresentation: 'HEX',
showAlways: false,
closeWithKey: 'Escape',
position: 'top-start',
adjustableNumbers: false,
components: {
palette: true,
preview: true,
opacity: false,
hue: true,

interaction: {
hex: true,
rgba: true,
hsla: false,
hsva: false,
cmyk: false,
input: true,
clear: false,
cancel: true,
save: true
if ($("meta[name='argon-enable-custom-theme-color']").attr("content") == 'true'){
let themeColorPicker = new Pickr({
el: '#theme-color-picker',
container: 'body',
theme: 'monolith',
closeOnScroll: false,
appClass: 'theme-color-picker-box',
useAsButton: false,
padding: 8,
inline: false,
autoReposition: true,
sliders: 'h',
disabled: false,
lockOpacity: true,
outputPrecision: 0,
comparison: false,
default: $("meta[name='theme-color']").attr("content"),
swatches: ['#5e72e4', '#fa7298', '#009688', '#607d8b', '#2196f3', '#3f51b5', '#ff9700', '#109d58', '#dc4437', '#673bb7', '#212121', '#795547'],
defaultRepresentation: 'HEX',
showAlways: false,
closeWithKey: 'Escape',
position: 'top-start',
adjustableNumbers: false,
components: {
palette: true,
preview: true,
opacity: false,
hue: true,
interaction: {
hex: true,
rgba: true,
hsla: false,
hsva: false,
cmyk: false,
input: true,
clear: false,
cancel: true,
save: true
}
},
strings: {
save: '确定',
clear: '清除',
cancel: '恢复博客默认'
}
},
strings: {
save: '确定',
clear: '清除',
cancel: '恢复博客默认'
}
});
themeColorPicker.on('change', instance => {
updateThemeColor(pickrObjectToHEX(instance), true);
})
themeColorPicker.on('save', (color, instance) => {
updateThemeColor(pickrObjectToHEX(instance._color), true);
themeColorPicker.hide();
})
themeColorPicker.on('cancel', instance => {
themeColorPicker.hide();
themeColorPicker.setColor($("meta[name='theme-color-origin']").attr("content").toUpperCase());
updateThemeColor($("meta[name='theme-color-origin']").attr("content").toUpperCase(), false);
setCookie("argon_custom_theme_color", "", 0);
});
});
themeColorPicker.on('change', instance => {
updateThemeColor(pickrObjectToHEX(instance), true);
})
themeColorPicker.on('save', (color, instance) => {
updateThemeColor(pickrObjectToHEX(instance._color), true);
themeColorPicker.hide();
})
themeColorPicker.on('cancel', instance => {
themeColorPicker.hide();
themeColorPicker.setColor($("meta[name='theme-color-origin']").attr("content").toUpperCase());
updateThemeColor($("meta[name='theme-color-origin']").attr("content").toUpperCase(), false);
setCookie("argon_custom_theme_color", "", 0);
});
}
function pickrObjectToHEX(color){
let HEXA = color.toHEXA();
return ("#" + HEXA[0] + HEXA[1] + HEXA[2]).toUpperCase();
Expand Down
1 change: 1 addition & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<meta name="theme-color" content="<?php echo $themecolor; ?>">
<meta name="theme-color-rgb" content="<?php echo hex2str($themecolor); ?>">
<meta name="theme-color-origin" content="<?php echo $themecolor_origin; ?>">
<meta name="argon-enable-custom-theme-color" content="<?php echo (get_option('argon_show_customize_theme_color_picker') != 'false' ? 'true' : 'false'); ?>">

<link rel="profile" href="http://gmpg.org/xfn/11">
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
Expand Down
4 changes: 2 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version" : "0.700",
"version" : "0.701",
"details_url" : "https://github.com/abc2237512422/argon-theme/releases",
"download_url" : "https://github.com/abc2237512422/argon-theme/releases/download/v0.700/argon.zip"
"download_url" : "https://github.com/abc2237512422/argon-theme/releases/download/v0.701/argon.zip"
}
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Theme Name: argon
Author: abc2237512422
Author URI: https://abc233.site/
Description: 轻盈、简洁、美观的 Wordpress 主题
Version: 0.700
Version: 0.701
License: MIT License
License URI: https://opensource.org/licenses/MIT
Tags: 简约, 两栏, 侧栏在左边, 浮动侧栏, 文章目录, 自适应, 夜间模式, 可自定义
Expand Down

0 comments on commit 7209d29

Please sign in to comment.