add admin colortheme addon and fix amber color picker, bump version to 2.2.13
This commit is contained in:
parent
7b636e5003
commit
7d8a09d7ce
7 changed files with 213 additions and 9 deletions
78
AvocadoEdition_Light/addons/admcolor/admcolor.addon.php
Normal file
78
AvocadoEdition_Light/addons/admcolor/admcolor.addon.php
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
class AdmcolorAddon extends Addon
|
||||
{
|
||||
public $name = "관리페이지 색상 변경 애드온";
|
||||
public $description = "관리페이지의 테마색상을 변경해주는 애드온입니다.";
|
||||
public $author = "Amber";
|
||||
public $link = "https://info.drk.st/about";
|
||||
public $version = "1.0.0";
|
||||
|
||||
public $className;
|
||||
public $addonPath;
|
||||
public $addonFile;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function init($data = [])
|
||||
{
|
||||
EventHandler::addEventHandler("gnuboard.admin.load_common", function() {
|
||||
global $html_process;
|
||||
if ($html_process && method_exists($html_process, "merge_stylesheet")) {
|
||||
$config = $this->getConfig();
|
||||
|
||||
$c1 = $config["color1"] ? $config["color1"] : "#FFF8F0";
|
||||
$c2 = $config["color2"] ? $config["color2"] : "#edd0b6";
|
||||
$c3 = $config["color3"] ? $config["color3"] : "#e3bb82";
|
||||
$c4 = $config["color4"] ? $config["color4"] : "#c7996b";
|
||||
$c5 = $config["color5"] ? $config["color5"] : "hsl(30, 72%, 55%)";
|
||||
$c6 = $config["color6"] ? $config["color6"] : "hsla(30, 72%, 55%, .2)";
|
||||
$c7 = $config["color7"] ? $config["color7"] : "hsl(45, 100%, 50%)";
|
||||
$c8 = $config["color8"] ? $config["color8"] : "#4a797b";
|
||||
$c9 = $config["color9"] ? $config["color9"] : "#A8DADC";
|
||||
|
||||
// add style to head
|
||||
$html_process->merge_stylesheet("<style>
|
||||
:root {
|
||||
--theme-color-0: {$c1} !important;
|
||||
--theme-color-a: {$c2} !important;
|
||||
--theme-color-b: {$c3} !important;
|
||||
--theme-color-c: {$c4} !important;
|
||||
--theme-color-d: {$c5} !important;
|
||||
--theme-color-d-gnb: {$c6} !important;
|
||||
--theme-color-e: {$c7} !important;
|
||||
--theme-color-sub: {$c8} !important;
|
||||
--theme-color-sub-b: {$c9} !important;
|
||||
}
|
||||
</style>", 99);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
public function printConfigForm()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
include_once __DIR__ . "/config.php";
|
||||
}
|
||||
|
||||
public function saveAction($data = [])
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql = "SELECT addon_config FROM {$g5['addons_config_table']} WHERE addon_name = '{$this->className}'";
|
||||
$result = sql_fetch($sql);
|
||||
|
||||
if ($result && isset($result['addon_config'])) {
|
||||
return json_decode($result['addon_config'], true) ?: [];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
117
AvocadoEdition_Light/addons/admcolor/config.php
Normal file
117
AvocadoEdition_Light/addons/admcolor/config.php
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<d?php
|
||||
if (!defined("_GNUBOARD_") || !defined("G5_IS_ADMIN")) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<style>
|
||||
.setter {
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-basis: 0;
|
||||
}
|
||||
|
||||
.default_btn {
|
||||
background: var(--theme-color-e);
|
||||
border-color: transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.default_btn:hover {
|
||||
background: var(--theme-color-d);
|
||||
}
|
||||
</style>
|
||||
<div class="tbl_frm01 tbl_wrap">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 140px;">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="bo-right">색상1 (배경색 전용)</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color1" value="<?= $config["color1"] ? $config["color1"] : "#FFF8F0" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color1]').value = '#FFF8F0';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상2</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color2" value="<?= $config["color2"] ? $config["color2"] : "#edd0b6" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color2]').value = '#edd0b6';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상3</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color3" value="<?= $config["color3"] ? $config["color3"] : "#e3bb82" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color3]').value = '#e3bb82';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상4</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color4" value="<?= $config["color4"] ? $config["color4"] : "#c7996b" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color4]').value = '#c7996b';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상5</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color5" value="<?= $config["color5"] ? $config["color5"] : "hsl(30, 72%, 55%)" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color5]').value = 'hsl(30, 72%, 55%)';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상6 (좌측메뉴 배경)</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color6" value="<?= $config["color6"] ? $config["color6"] : "hsla(30, 72%, 55%, .2)" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color6]').value = 'hsla(30, 72%, 55%, .2)';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상7</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color7" value="<?= $config["color7"] ? $config["color7"] : "hsl(45, 100%, 50%)" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color7]').value = 'hsl(45, 100%, 50%)';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상8</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color8" value="<?= $config["color8"] ? $config["color8"] : "#4a797b" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color8]').value = '#4a797b';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bo-right">색상9</th>
|
||||
<td>
|
||||
<div class="setter">색상<input type="text" name="color9" value="<?= $config["color9"] ? $config["color9"] : "#A8DADC" ?>"
|
||||
class="neo_color" size="30" maxlength="255" placeholder="#색상코드" />
|
||||
<button type="button" class="default_btn" onclick="document.querySelector('[name=color9]').value = '#A8DADC';">기본값</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -77,7 +77,16 @@ class SampleAddon extends Addon
|
|||
|
||||
public function saveAction($data = [])
|
||||
{
|
||||
|
||||
// 이미지 업로드 등 입력 후처리가 필요한 경우에 사용합니다.
|
||||
// $data 에는 입력값 ($_POST) 가 전달됩니다.
|
||||
/*
|
||||
if (!empty($data)) {
|
||||
// ... 이미지 업로드 처리 예시 ...
|
||||
$extension = emplode(".", $_FILES['input_name']['name']);
|
||||
$extension = $extension[-1];
|
||||
// ... 이미지 업로드 처리 예시 ...
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public function getConfig()
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@
|
|||
display: grid;
|
||||
position: relative;
|
||||
border: 1px solid #E8E7E0;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
grid-template-columns: repeat(5, 20px);
|
||||
grid-template-rows: repeat(9, 1fr);
|
||||
width: calc(21px * 5 - 1);
|
||||
gap: 1px;
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ class ColorPicker {
|
|||
let s = parseInt(match[2]) / 100;
|
||||
let v = parseInt(match[3]) / 100;
|
||||
let a = match[4] ? parseFloat(match[4]) : 1;
|
||||
return hsvToRgb(h, s, v, a);
|
||||
return this.hsvToRgb(h, s, v, a);
|
||||
}
|
||||
|
||||
// HSL and HSLA
|
||||
|
|
@ -374,7 +374,7 @@ class ColorPicker {
|
|||
let s = parseInt(match[2]) / 100;
|
||||
let l = parseInt(match[3]) / 100;
|
||||
let a = match[4] ? parseFloat(match[4]) : 1;
|
||||
return hslToRgb(h, s, l, a);
|
||||
return this.hslToRgb(h, s, l, a);
|
||||
}
|
||||
|
||||
// HWB
|
||||
|
|
@ -384,7 +384,7 @@ class ColorPicker {
|
|||
let w = parseInt(match[2]) / 100;
|
||||
let b = parseInt(match[3]) / 100;
|
||||
let a = match[4] ? parseFloat(match[4]) : 1;
|
||||
return hwbToRgb(h, w, b, a);
|
||||
return this.hwbToRgb(h, w, b, a);
|
||||
}
|
||||
|
||||
// LAB
|
||||
|
|
@ -394,7 +394,7 @@ class ColorPicker {
|
|||
let a = parseFloat(match[2]);
|
||||
let b = parseFloat(match[3]);
|
||||
let alpha = match[4] ? parseFloat(match[4]) : 1;
|
||||
return labToRgb(l, a, b, alpha);
|
||||
return this.labToRgb(l, a, b, alpha);
|
||||
}
|
||||
|
||||
// LCH
|
||||
|
|
@ -404,7 +404,7 @@ class ColorPicker {
|
|||
let c = parseFloat(match[2]);
|
||||
let h = parseFloat(match[3]);
|
||||
let alpha = match[4] ? parseFloat(match[4]) : 1;
|
||||
return lchToRgb(l, c, h, alpha);
|
||||
return this.lchToRgb(l, c, h, alpha);
|
||||
}
|
||||
|
||||
// If no match found, return null
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ class Setting
|
|||
}
|
||||
$this->settings[] = [
|
||||
"type" => "color2",
|
||||
"html" => "<td class=\"bo-right\">{$desc}</td><td><div class=\"setter\">색상<input type=\"text\" name=\"cs_etc_{$idx}[{$this->idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></td></tr>"
|
||||
"html" => "<td class=\"bo-right\">{$desc}</td><td><div class=\"setter\">색상<input type=\"text\" name=\"cs_etc_{$idx}[{$this->idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>"
|
||||
];
|
||||
}
|
||||
// error
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
********************/
|
||||
|
||||
define('G5_VERSION', '아보카도 에디션 : Amber');
|
||||
define('G5_GNUBOARD_VER', '2.2.12');
|
||||
define('G5_GNUBOARD_VER', '2.2.13');
|
||||
define('G5_AMBER', true);
|
||||
define('_GNUBOARD_', true);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue