hyyan/admin-color-schema

此包已被废弃且不再维护。没有建议的替代包。

WordPress插件,允许WordPress主题直接从主题添加自己的管理颜色方案

安装: 72

依赖项: 0

建议者: 0

安全性: 0

星级: 3

关注者: 1

分支: 0

开放问题: 0

语言:CSS

类型:WordPress插件

0.4.4 2014-12-22 19:02 UTC

This package is not auto-updated.

Last update: 2020-01-20 04:01:14 UTC


README

project status Latest Stable Version Total Downloads License

此插件允许WordPress主题直接从主题添加自己的管理颜色方案

功能

  1. 直接通过主题添加新的管理颜色方案
  2. 为每个新注册的用户自动激活特定的管理颜色方案
  3. 从用户配置文件中删除管理颜色选择器
  4. 在前端将选定的管理颜色方案应用于WordPress管理栏

如何安装

传统方式

  1. 将插件作为zip存档下载,然后上传到您的WordPress插件文件夹并解压缩。
  2. 从您的管理面板激活插件

Composer方式

  1. 运行Composer命令: composer require hyyan/admin-color-schema

示例

该插件包含一个示例来展示如何使用插件,它位于example/Dark文件夹中。

要使用示例

  1. example/Dark复制到your/theme/folder/color-schema/Dark
  2. 从您的配置文件激活新的方案

ScreenShot

如何使用

插件配置

该插件默认提供以下配置

$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;
});

创建新方案

如果您正在使用插件配置中的默认路径

  1. 在您的主题根目录中创建color-schema
  2. color-schema中创建新的方案目录,例如:在color-schema中创建vivid
  3. 创建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
  1. 创建如以下示例的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";

完成...

现在转到您的配置文件,您将看到您的新颜色方案,您可以激活它

贡献

每个人都欢迎帮助贡献并改进此插件。您可以通过以下几种方式来贡献

  • 报告问题(请阅读问题指南
  • 建议新功能
  • 编写或重构代码
  • 修复问题