hyyan/ admin-color-schema
此包已被废弃且不再维护。没有建议的替代包。
WordPress插件,允许WordPress主题直接从主题添加自己的管理颜色方案
0.4.4
2014-12-22 19:02 UTC
Requires
- php: >=5.3.2
- composer/installers: ~1.0
README
此插件允许WordPress主题直接从主题添加自己的管理颜色方案
功能
- 直接通过主题添加新的管理颜色方案
- 为每个新注册的用户自动激活特定的管理颜色方案
- 从用户配置文件中删除管理颜色选择器
- 在前端将选定的管理颜色方案应用于WordPress管理栏
如何安装
传统方式
- 将插件作为zip存档下载,然后上传到您的WordPress插件文件夹并解压缩。
- 从您的管理面板激活插件
Composer方式
- 运行Composer命令:
composer require hyyan/admin-color-schema
示例
该插件包含一个示例来展示如何使用插件,它位于example/Dark
文件夹中。
要使用示例
- 将
example/Dark
复制到your/theme/folder/color-schema/Dark
- 从您的配置文件激活新的方案
如何使用
插件配置
该插件默认提供以下配置
$default = array( // path relative to the theme dir 'path' => '/color-schema', // default color-schema to activate for every new user 'default' => '', // if true the user will be no more able to change its dashboard color schema // and the default one will be used 'disable_color_picker' => false, // enable color-schema on fontend 'enbale-on-frontend' => true, );
您可以使用add_filters
函数覆盖默认配置,如下例所示
// in the your theme's functions.php file add_filter('Hyyan\AdminColorSchema.options', function(array $default) { // read schemas from "admin-color-schema" folder relative to current theme $default['path'] = '/admin-color-schema'; // use Bluetheme as default schema for every new user $default['default'] = 'BlueTheme'; return $default; });
创建新方案
如果您正在使用插件配置中的默认路径
- 在您的主题根目录中创建
color-schema
- 在
color-schema
中创建新的方案目录,例如:在color-schema
中创建vivid
- 创建
schema.ini
文件并按以下示例进行配置
; the name of your theme if not set the current dir name will be used ; for example if your theme live in "color-schema/vivid" then "vivid" will be used as name of theme name= my create theme ;your translaion domain if not set the 'defualt' domain will be used ;the domain will be used to translate the theme name domain= default ; colors preview (4 colors) colors []= #52accc colors []= #e5f8ff colors []= #096484 colors []= #e1a948 ; icons colors preview (4 colors) icons []= #52accc icons []= #e5f8ff icons []= #096484 icons []= #e1a948
- 创建如以下示例的
colors.scss
,然后将其编译为colors.css
$base-color: #52accc; $icon-color: #e5f8ff; $highlight-color: #096484; $notification-color: #e1a948; $button-color: #e1a948; $menu-submenu-text: #e2ecf1; $menu-submenu-focus-text: #fff; $menu-submenu-background: #4796b3; @import "...../wp-admin/css/colors/_admin.scss";
完成...
现在转到您的配置文件,您将看到您的新颜色方案,您可以激活它
贡献
每个人都欢迎帮助贡献并改进此插件。您可以通过以下几种方式来贡献