• ExtJS-Theme(主题配置)


    配置预定义主题

    预设主题列表

    classic主题

    查看目录:\ext73\7.3.0.55\commercial\build\classic

    具体主题如下:
    theme-aria
    theme-classic
    theme-classic-sandbox
    theme-crisp
    theme-crisp-touch
    theme-graphite
    theme-gray
    theme-material
    theme-neptune
    theme-neptune-touch
    theme-triton

    modern主题

    查看目录:\ext73\7.3.0.55\commercial\build\modern

    具体主题如下:
    theme-ios
    theme-material
    theme-neptune
    theme-triton

    预定义主题的继承关系

    image

    配置主题-使用Sencha CMD

    打开项目文件夹下的app.json文件image

    找到build节,修改对应主题的theme配置项

    1. "builds": {
    2. "classic": {
    3. "toolkit": "classic",
    4. "theme": "theme-material",
    5. "sass": {
    6. "generated": {
    7. "var": "classic/sass/save.scss",
    8. "src": "classic/sass/save"
    9. }
    10. },
    11. "requires": [
    12. "ext-locale"
    13. ]
    14. },
    15. "modern": {
    16. "toolkit": "modern",
    17. "theme": "theme-material",
    18. "sass": {
    19. "generated": {
    20. "var": "modern/sass/save.scss",
    21. "src": "modern/sass/save"
    22. }
    23. },
    24. "requires": [
    25. "ext-locale"
    26. ]
    27. }
    28. },

    配置完成后,在Sencha CMD中执行构建

    sencha app build

    配置主题-使用引入CSS文件

    根据需要引入对应主题的CSS文件和js文件即可

    找到ExtJS SDK build目录,复制到项目目录下:image
    引入对应的主题css和js文件:

    1. html>
    2. <html lang="zh-CN">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <link rel="stylesheet" href="build/classic/theme-material/resources/theme-material-all-debug.css">
    7. <title>ExtJS73title>
    8. head>
    9. <body>
    10. <script src="build/ext-all-debug.js">script>
    11. <script src="build/classic/locale/locale-zh_CN-debug.js">script>
    12. <script src="build/classic/theme-material/theme-material-debug.js">script>
    13. <script>
    14. Ext.onReady(function(){
    15. });
    16. script>
    17. body>
    18. html>

    配置自定义主题(Creating a custom theme)

    说明

    除了预定义的主题外还可以自己修改主题

    预定义主题的继承关系

    image

    制作主题

    制作前注意

    ExtJS具有跨平台样式(Cross-browser styling)支持,会为我们处理跨平台问题
    生成的主题默认继承自ext-theme-classic,可以手动更改

    生成一个空白的主题

    sencha generate theme panda-theme

    命令执行后,会在packages目录下生成一个panda-theme的目录

    image
    里面包含我们自定义的主题文件,文件和文件夹说明:

    1. package.json: This is where all the package’s details and configurations are defined
    2. sass/var: This will be where we put all of our SASS variable overrides
    3. sass/src: This is where we define styling for individual components
    4. sass/etc: This is where any miscellaneous SASS files, which don’t tie directly to a
    5. component file, can be placed

    修改主题文件
    修改生成的主题文件即可
    修改主题CSS变量(Theme variables)
    可以在组件文档中查看组件支持的CSS变量,可以自己手动修改

    image
    在sass/var文件夹中,定义我们自己的变量
    比如修改button组件的变量,可以定义:sass/var/button/Button.scss文件
    当添加样式表时,需要放在sass/src文件夹中
    在其中写入要修改的变量即可
    常见变量
    Global_CSS 中定义了所有支持的自定义变量

    1. $base-color
    2. $base-color: color (e.g. $base-color : #808080)

    主题的基础颜色

    1. $base-gradient
    2. $base-gradient: string (e.g. $base-gradient : 'matte')

    主题的基础渐变

    1. $body-background-color
    2. $body-background-color: color (e.g. $body-background-color : #808080)

    主题的body元素的背景颜色
    如果设置为transparent 或者 'none'将会没有颜色

    1. $color
    2. $color : color (e.g. $color : #808080)

    主题默认的文本颜色

    1. $font-family
    2. $font-family : string (e.g. $font-family : arial)

    主题默认的字体

    $font-size
    $font-size : number (e.g. $font-size : 9px )
    主题默认的字体大小

    1. $font-weight
    2. $font-weight : string/number (e.g. $font-weight : normal )

    主题默认的字体厚度

    1. $font-weight-bold
    2. $font-weight-bold : string/number (e.g. $font-weight-bold : bold )

    主题默认的字体厚度值

    1. $include-chrome
    2. $include-chrome : boolean (e.g. $include-chrome : true)

    是否添加chrome独有的属性

    1. $include-ff
    2. $include-ff : boolean (e.g. $include-ff : true)

    是否添加Firefox独有的属性

    1. $include-ie
    2. $include-ie : boolean (e.g. $include-ie:true)

    是否添加IE独有的属性

    1. $include-opera
    2. $include-opera : boolean (e.g. $include-opera : true)

    是否添加Opera独有的属性

    1. $include-safari
    2. $include-safari : boolean (e.g. $include-safari : true)

    是否添加safari独有的属性

    1. $include-webkit
    2. $include-webkit : boolean (e.g. $include-webkit : true)

    是否添加Webkit独有的属性
    使用自定义主题(Applying the new theme)
    在app.json文件中修改theme配置项为自定义的主题名称即可

  • 相关阅读:
    迅为龙芯开发板系统编译安装pmoncfg
    RocketMQ5.0源码分析-高可用组件AutoSwitchHAClient图文详解
    网络安全(黑客)自学
    数据结构之链表详解(1)
    深入剖析怎么分析进程crash问题(上)
    day21-web开发会话技术03
    squid代理服务器(传统代理、透明代理、反向代理、ACL、日志分析)
    十四届蓝桥青少组模拟赛Python-20221108
    Vue (八) --------- 混入、插件与 scope 样式
    非线性优化问题基本形式概述
  • 原文地址:https://blog.csdn.net/weixin_38304160/article/details/126191301