Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] Add JS color picker for color input type fields #8172

Open
wants to merge 1 commit into
base: release-3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Sources/Actions/Admin/ACP.php
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,15 @@ protected function __construct()
Theme::loadJavaScriptFile('admin.js', ['minimize' => true], 'smf_admin');
Theme::loadCSSFile('admin.css', [], 'smf_admin');

Theme::loadCSSFile('coloris.min.css', [], 'coloris');
Theme::loadJavaScriptFile('coloris.min.js', [], 'coloris');
Theme::addInlineJavaScript('
Coloris({
rtl: ' . (Utils::$context['right_to_left'] ? 'true' : 'false') . ',
themeMode: "auto",
format: "auto",
});', true);

// Set any dynamic values in $this->admin_areas.
$this->setAdminAreas();

Expand Down
1 change: 1 addition & 0 deletions Sources/Actions/Credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ public function execute(): void
'<a href="https://github.com/enyo/dropzone">Dropzone.js</a> | © Matias Meno | Licensed under <a href="https://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/matthiasmullie/minify">Minify</a> | © Matthias Mullie | Licensed under <a href="https://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/true/php-punycode">PHP-Punycode</a> | © True B.V. | Licensed under <a href="https://en.wikipedia.org/wiki/MIT_License">The MIT License (MIT)</a>',
'<a href="https://github.com/mdbassit/Coloris">Coloris</a> | © Mohammed Bassit | Licensed under <a href="https://github.com/mdbassit/Coloris/blob/main/LICENSE">The MIT License (MIT)</a>',
],
'fonts' => [
'<a href="https://fontlibrary.org/en/font/anonymous-pro"> Anonymous Pro</a> | © 2009 | This font is licensed under the SIL Open Font License, Version 1.1',
Expand Down
7 changes: 7 additions & 0 deletions Themes/default/Admin.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,13 @@ function ($v)
</select>';
}

// Show a color box
elseif ($config_var['type'] == 'color')
{
echo '
<input name="', $config_var['name'], '" id="', $config_var['name'], '" data-coloris value="', $config_var['value'], '">';
}

// List of boards? This requires getBoardList() having been run and the results in Utils::$context['board_list'].
elseif ($config_var['type'] == 'boards')
{
Expand Down
1 change: 1 addition & 0 deletions Themes/default/css/coloris.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading