跳到正文

复用成熟 App 的主题配色:从原生模块到可复用数据(1):从安装资源提取主题配置

复用成熟 App 的主题配色:从原生模块到可复用数据

  1. 从安装资源提取主题配置(当前)
  2. 从基础色推导界面配色
  3. 在 App 与 Figma 中复用配色

截图里的颜色已经与背景合成,直接取色会丢掉原始透明度。Windows QQ 9.9.36-53644 的安装资源中保存了主题和 Token 配置,可以在保留来源的前提下导出它们。这里从定位文件开始,走到能重新执行的提取脚本;读取过程不修改 QQ 安装文件。

从安装资源到保留来源的颜色

从 ASAR 找到原生模块中的 JSON

Electron 应用常用 ASAR 存放资源。ASAR 的官方格式说明把它描述为带 JSON 索引的归档:索引记录文件名、大小和偏移,文件内容排列在后面。读出目录和文件,解决的是归档这一层。

QQ 的安装目录下,versions/config.json 指向当前版本。对应 resources/app/package.json 里有这样的字段:

{
  "main": "./application.asar/app_launcher/index.js",
  "isByteCodeShell": true
}

这份 application.asar 的索引可以解析,里面有 1452 个文件条目。但抽出的脚本和样式内容不是普通 UTF-8 文本,无法靠搜索 JavaScript 源码找到颜色数组。isByteCodeShell 也提示这里存在字节码壳;仅凭这些现象还不足以确定全部文件的处理算法。

配色功能需要把配置交给界面使用,所以继续检查应用目录中的原生模块。wrapper.node 虽然是二进制文件,其中仍保存了两段以 NUL(零字节)结束的 UTF-8 JSON 常量。找到前缀、取到结束标记,再 JSON.parse 就能读到结构。

内容 搜索前缀 字节偏移 长度
主题配置 {"systemThemeInfoList": 67920864 21688 字节
Token 配置 {"default_theme": 67942560 7727 字节

偏移属于这份 117866024 字节的模块,换版本后会变化。提取脚本每次搜索前缀,并把模块 SHA-256、JSON 偏移、长度和哈希写进来源清单,便于复核。读取常量的关键步骤只有这些:

const offset = nativeData.indexOf('{"systemThemeInfoList":');
const end = nativeData.indexOf(0, offset);
const bytes = nativeData.subarray(offset, end);
const config = JSON.parse(bytes.toString('utf8'));

完整脚本还会检查前缀和结束标记是否存在、验证结构,并保存原始字节。这条路径需要读取本机安装文件,提取过程没有修改 QQ。

在自己的 QQ 上重新提取

想提取自己安装的版本,下载独立脚本,安装 Node.js,在脚本所在目录运行:

node .\extract-qq-palettes.mjs

默认安装路径是 C:/Program Files/Tencent/QQNT,脚本从 versions/config.json 读取当前版本,再检查 wrapper.node 和 Skin 主题配置目录。结果写入脚本所在目录,同名导出文件会被覆盖。安装位置不同可传 --qq-root,文档目录不同可传 --skin-cache;--app 可直接指定某个版本的 resources/app,--out 指定输出目录。

node .\extract-qq-palettes.mjs --qq-root 'D:\Apps\QQNT' --out '.\export'

重新提取依赖该版本仍保存相同形态的 JSON 常量。若前缀或结构改变,脚本会报告缺失或解析错误,需要重新检查资源;已有偏移不能跨版本硬用。

把数据交给 Coding Agent 接入项目时,可以用这个入口:

工具包根路径:https://shengsheng.fun/files/qq-super-palette-extraction/kits/qq-palette-extractor/
先读 README.md、MANIFEST.json、FILES.json,再按索引读取源码。
现成主题读取 data/qq-palettes.json 与 data/qq-derived-palettes.json,保留透明度与来源。
自定义主题参考 data/qq-derivation-algorithm.md,迁移 copy/ 中的派生模块及 vendor/。
分别保留基础色阶与界面角色,检查最终前景/背景对比和阈值边界。
完整源码工作区弹窗

把 ARGB 转换成 CSS

原始配置中的颜色是十进制整数。例如经典蓝的 4278229503,写成十六进制是 0xFF0099FF。

ARGB 用四个字节分别保存 Alpha、红、绿、蓝,每个字节取值 0–255。Alpha 为 0 表示完全透明,255 表示完全不透明。QQ 的顺序是 AARRGGBB;CSS 八位 HEX 的顺序是 RRGGBBAA。

这个蓝色完全不透明,转成 #0099FF 很直观。但另一个实际色值 2578568648 对应 0x99B1D5C8,Alpha 是 0x99 / 255,也就是 0.6(60% 不透明度)。正确 CSS 是 #B1D5C899,或 rgba(177, 213, 200, 0.6)。直接截成六位 HEX 会丢掉透明度;把原始八位十六进制直接写进 CSS,则连 RGB 通道都会错位。

转换演示、错误色值对照和无符号位移代码见ARGB 转换演示弹窗。用于样式时优先取 css 或 hex8,原始 argb 留作追溯。

QQ 内置主题的原始配置弹窗保留原始整数,可与转换后的 CSS 色值逐项核对。

缓存只能证明配置曾经出现

两份本地缓存中的重复配色与内置配置一致,但覆盖范围不同,旧版系统主题的背景数量也不同。两份缓存的比对与来源处理弹窗保留差异;presentInCache 不能证明当前界面展示、账号可用或在线目录完整。

结果与更新边界

这份版本快照包含 7 个系列、37 个固定条目。原始字节与 SHA-256、颜色整数的往返转换各有核对;它们不代表所有在线主题或账号可用范围。更新客户端后应重新搜索和校验结构,不能套用旧偏移。

安装资源解析与本机重新提取:完整源码
QQ 配色提取脚本正在加载代码工作区...
QQ 内置主题的原始配置

查看主题名称、明暗配色数组和纹理字段

打开原文件 theme-config.json

{
  "systemThemeInfoList": [
    {
      "id": 0,
      "light": {
        "primaryColor": [
          4278229503
        ],
        "aioInfo": {
          "color": [
            4293587455,
            4294964223,
            4292930559,
            4292274687
          ]
        },
        "bubbleInfo": {
          "color": [
            4278229503
          ]
        }
      },
      "dark": {
        "primaryColor": [
          4278216396
        ],
        "aioInfo": {
          "color": [
            4279900698
          ]
        },
        "bubbleInfo": {
          "color": [
            4280690214
          ]
        }
      }
    },
    {
      "id": 1,
      "light": {
        "primaryColor": [
          4278229503
        ],
        "aioInfo": {
          "color": [
            4293587455,
            4294964223,
            4292930559,
            4292274687
          ]
        },
        "bubbleInfo": {
          "color": [
            4278229503
          ]
        }
      },
      "dark": {
        "primaryColor": [
          4278216396
        ],
        "aioInfo": {
          "color": [
            4279900698
          ]
        },
        "bubbleInfo": {
          "color": [
            4280690214
          ]
        }
      }
    }
  ],
  "templateThemeInfoList": [
    {
      "id": 1003,
      "name": "水墨国风",
      "desc": "秋水共长天一色",
      "themeList": [
        {
          "name": "随心调",
          "colorId": 0,
          "primaryColor": [],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1003/0-light-BFE415C9.png",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1003/0-dark-185B07BC.png"
        },
        {
          "name": "典雅金",
          "colorId": 1,
          "primaryColor": [
            4290486125
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1003/1-light-838430CC.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1003/1-dark-A8828F6B.svg"
        },
        {
          "name": "丁香紫",
          "colorId": 2,
          "primaryColor": [
            4286542724
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1003/2-light-6240A45D.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1003/2-dark-50DD1FEA.svg"
        },
        {
          "name": "芸豆青",
          "colorId": 3,
          "primaryColor": [
            4286613882
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1003/3-light-EEB1B930.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1003/3-dark-02BB4921.svg"
        },
        {
          "name": "辰砂色",
          "colorId": 4,
          "primaryColor": [
            4287257170
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1003/4-light-2A2D9705.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1003/4-dark-E6E84745.svg"
        },
        {
          "name": "天青色",
          "colorId": 5,
          "primaryColor": [
            4287871697
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1003/5-light-B80568E3.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1003/5-dark-C80D1898.svg"
        }
      ]
    },
    {
      "id": 1004,
      "name": "神秘美学",
      "desc": "每天一点甜,生活好运连连",
      "texture": {
        "url": "https://qqpatch.gtimg.cn/template_theme/texture/1004.svg",
        "opaque": 0.12,
        "layout": 1,
        "blendMode": 0
      },
      "themeList": [
        {
          "name": "随心调",
          "colorId": 0,
          "primaryColor": [],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1004/0-light-32E07408.png",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1004/0-dark-69EF065B.png"
        },
        {
          "name": "心想事橙",
          "colorId": 1,
          "primaryColor": [
            4294948729
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1004/1-light-53D638EF.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1004/1-dark-EB02630D.svg"
        },
        {
          "name": "不再焦绿",
          "colorId": 2,
          "primaryColor": [
            4291742544
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1004/2-light-551BCC12.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1004/2-dark-D3422370.svg"
        },
        {
          "name": "蓝以为情",
          "colorId": 3,
          "primaryColor": [
            4289644794
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1004/3-light-5A4C2E77.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1004/3-dark-856BC121.svg"
        },
        {
          "name": "紫属于你",
          "colorId": 4,
          "primaryColor": [
            4290743032
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1004/4-light-594CC46F.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1004/4-dark-940A4631.svg"
        },
        {
          "name": "青青松松",
          "colorId": 5,
          "primaryColor": [
            4285390748
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1004/5-light-E1196FC2.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1004/5-dark-81F54F7B.svg"
        }
      ]
    },
    {
      "id": 1001,
      "name": "缤纷时刻",
      "desc": "小小画板上映射生活的美好",
      "texture": {
        "url": "https://qqpatch.gtimg.cn/template_theme/texture/1001.svg",
        "opaque": 0.2,
        "layout": 0,
        "blendMode": 1
      },
      "themeList": [
        {
          "name": "随心调",
          "colorId": 0,
          "primaryColor": [],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1001/0-light-ABC12B2F.png",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1001/0-dark-040501D7.png"
        },
        {
          "name": "香芋啵啵",
          "colorId": 1,
          "primaryColor": [
            4289956344
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1001/1-light-7EEC4F11.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1001/1-dark-452D4020.svg"
        },
        {
          "name": "海盐粉荔",
          "colorId": 3,
          "primaryColor": [
            4282422753
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1001/3-light-ABA15027.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1001/3-dark-4E3897BC.svg"
        },
        {
          "name": "橘子汽水",
          "colorId": 2,
          "primaryColor": [
            4293101103
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1001/2-light-63F079FD.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1001/2-dark-7691F99F.svg"
        },
        {
          "name": "绿豆冰沙",
          "colorId": 4,
          "primaryColor": [
            4288141465
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1001/4-light-F3D7EACE.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1001/4-dark-3B25672F.svg"
        },
        {
          "name": "草莓大福",
          "colorId": 5,
          "primaryColor": [
            4294029298
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1001/5-light-EB240507.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1001/5-dark-F080046F.svg"
        }
      ]
    },
    {
      "id": 1002,
      "name": "幻彩机核",
      "desc": "永不止境的黑夜和炽热不羁的心跳",
      "flag": 2,
      "texture": {
        "url": "https://qqpatch.gtimg.cn/template_theme/texture/1002.svg",
        "opaque": 0.2,
        "layout": 0,
        "blendMode": 1
      },
      "themeList": [
        {
          "name": "随心调",
          "colorId": 0,
          "primaryColor": [],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1002/0-light-0BEC3649.png",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1002/0-dark-0BEC3649.png"
        },
        {
          "name": "霓虹灯光",
          "colorId": 1,
          "primaryColor": [
            4292014679
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1002/1-light-55998035.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1002/1-dark-8CD710EF.svg"
        },
        {
          "name": "粉墨都市",
          "colorId": 3,
          "primaryColor": [
            4287233021
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1002/3-light-FF1C4D46.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1002/3-dark-CE7924DA.svg"
        },
        {
          "name": "废土朋克",
          "colorId": 2,
          "primaryColor": [
            4293690334
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1002/2-light-19F8CAFF.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1002/2-dark-01A6CE31.svg"
        },
        {
          "name": "魔幻丛林",
          "colorId": 4,
          "primaryColor": [
            4293824637
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1002/4-light-0F137DE9.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1002/4-dark-97DCB2E7.svg"
        },
        {
          "name": "与光同尘",
          "colorId": 5,
          "primaryColor": [
            4288521720
          ],
          "thumbnailLight": "https://qqpatch.gtimg.cn/template_theme/1002/5-light-AFB14278.svg",
          "thumbnailDark": "https://qqpatch.gtimg.cn/template_theme/1002/5-dark-4AACBF13.svg"
        }
      ]
    }
  ],
  "systemThemePackageList": [
    {
      "id": 1,
      "name": "故宫美学",
      "slogan": "处处座之旁,率陈如意常",
      "desc": "“故宫的建筑、器物、服饰、绘画、色彩万千,承载着传统的美学,传递着中华的审美。” ——《中国传统色》,QQ美学顾问郭浩",
      "mediaPreview": "https://qqpatch.gtimg.cn/images/appearance/mr_guo.jpg",
      "themeList": [
        {
          "id": 5001,
          "name": "缥碧沧浪",
          "desc": "古人说天缥,我们说天青色。缥碧流水千里,沧浪我心悠悠。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/gugong/palette/1.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/gugong/dialog/1.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/1.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/1.png",
          "light": {
            "primaryColor": [
              4282619542
            ],
            "aioInfo": {
              "color": [
                4289844680,
                4292209633,
                4288265388,
                4286620818
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/1.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4282619542,
                4282619542
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4282619542
            ],
            "aioInfo": {
              "color": [
                2578568648,
                2580933601,
                2576989356,
                2575344786
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/1.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4282619542,
                4282619542
              ]
            }
          }
        },
        {
          "id": 5002,
          "name": "生如夏花",
          "desc": "夏日炎炎,大地草木的生命达于顶点,芙蓉出水,翠竹参天,色彩的热烈彷佛生命的礼赞。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/gugong/palette/2.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/gugong/dialog/2.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/2.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/2.png",
          "light": {
            "primaryColor": [
              4283119950
            ],
            "aioInfo": {
              "color": [
                4288384681,
                4292070614,
                4287259019,
                4289166763
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/2.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283119950,
                4283119950
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4283119950
            ],
            "aioInfo": {
              "color": [
                2577108649,
                2580794582,
                2575982987,
                2577890731
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/2.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283119950,
                4283119950
              ]
            }
          }
        },
        {
          "id": 5003,
          "name": "象物新生",
          "desc": "青圭尖尖,青葱玉挺,象征着初生的生命力,一抹中国青,千载中国情。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/gugong/palette/3.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/gugong/dialog/3.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/3.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/3.png",
          "light": {
            "primaryColor": [
              4283847989
            ],
            "aioInfo": {
              "color": [
                4290756758,
                4292202926,
                4289308806,
                4288650602
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/3.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283847989,
                4283847989
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4283847989
            ],
            "aioInfo": {
              "color": [
                2579480726,
                2580926894,
                2578032774,
                2577374570
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/3.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283847989,
                4283847989
              ]
            }
          }
        },
        {
          "id": 5004,
          "name": "流光溢彩",
          "desc": "天水落纱衣,新汁染罗裙,绛色生异彩,琥珀发幽光。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/gugong/palette/4.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/gugong/dialog/4.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/4.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/4.png",
          "light": {
            "primaryColor": [
              4287188567
            ],
            "aioInfo": {
              "color": [
                4291793566,
                4293111225,
                4289886071,
                4290474874
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/4.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4287188567,
                4287188567
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4287188567
            ],
            "aioInfo": {
              "color": [
                2580517534,
                2581835193,
                2578610039,
                2579198842
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/4.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4287188567,
                4287188567
              ]
            }
          }
        },
        {
          "id": 5005,
          "name": "尘心不皂",
          "desc": "以一颗不染的心,不肯驯良地走入黑夜,凡尘如梦,梦里银白闪亮。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/gugong/palette/5.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/gugong/dialog/5.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/5.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/gugong/preview/5.png",
          "light": {
            "primaryColor": [
              4286083687
            ],
            "aioInfo": {
              "color": [
                4292532439,
                4291151301,
                4292862169,
                4288124554
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/5.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4286083687,
                4286083687
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4286083687
            ],
            "aioInfo": {
              "color": [
                2581256407,
                2579875269,
                2581586137,
                2576848522
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/gugong/5.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4286083687,
                4286083687
              ]
            }
          }
        }
      ]
    },
    {
      "id": 2,
      "name": "敦煌美学",
      "slogan": "沉睡千年,一醒惊天下",
      "desc": "“敦煌的洞窟、壁画、雕塑,它是文明汇聚的艺术圣殿,也是1600年的传统色彩颜料数据库。” ——《中国传统色》,QQ美学顾问郭浩",
      "mediaPreview": "https://qqpatch.gtimg.cn/images/appearance/mr_guo.jpg",
      "themeList": [
        {
          "id": 5006,
          "name": "红消绿冷",
          "desc": "这里的飞天,红、绿都降低了明度,两种互补色的明度趋同,带来了和谐。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/dunhuang/palette/1.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/dunhuang/dialog/1.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/1.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/1.png",
          "light": {
            "primaryColor": [
              4283190806
            ],
            "aioInfo": {
              "color": [
                4288972379,
                4288707413,
                4292403133,
                4289240458
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/1.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283190806,
                4283190806
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4283190806
            ],
            "aioInfo": {
              "color": [
                2577696347,
                2577431381,
                2581127101,
                2577964426
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/1.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283190806,
                4283190806
              ]
            }
          }
        },
        {
          "id": 5007,
          "name": "碧落空歌",
          "desc": "晋代的顾恺之说:“清天中,凡天及水色,尽用空青,竟素上下以暎日。”",
          "palette": "https://qqpatch.gtimg.cn/static_theme/dunhuang/palette/2.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/dunhuang/dialog/2.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/2.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/2.png",
          "light": {
            "primaryColor": [
              4283516780
            ],
            "aioInfo": {
              "color": [
                4285753469,
                4285558673,
                4292919987,
                4287140486
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/2.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283516780,
                4283516780
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4283516780
            ],
            "aioInfo": {
              "color": [
                2574477437,
                2574282641,
                2581643955,
                2575864454
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/2.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283516780,
                4283516780
              ]
            }
          }
        },
        {
          "id": 5008,
          "name": "白贲无咎",
          "desc": "虎身如矫龙,虎爪如卷云,在中原文化中,白虎是辟邪、祈福的祥瑞。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/dunhuang/palette/3.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/dunhuang/dialog/3.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/3.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/3.png",
          "light": {
            "primaryColor": [
              4283636747
            ],
            "aioInfo": {
              "color": [
                4289879879,
                4289818442,
                4292459677,
                4290155908
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/3.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283636747,
                4283636747
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4283636747
            ],
            "aioInfo": {
              "color": [
                2578603847,
                2578542410,
                2581183645,
                2578879876
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/3.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283636747,
                4283636747
              ]
            }
          }
        },
        {
          "id": 5009,
          "name": "绿壁乌龙",
          "desc": "天池绿水荡漾,池中心游龙戏水妖娆,龙首龙尾环绕火焰宝珠。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/dunhuang/palette/4.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/dunhuang/dialog/4.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/4.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/4.png",
          "light": {
            "primaryColor": [
              4283658320
            ],
            "aioInfo": {
              "color": [
                4289967266,
                4286812021,
                4291208859,
                4285956454
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/4.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283658320,
                4283658320
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4283658320
            ],
            "aioInfo": {
              "color": [
                2578691234,
                2575535989,
                2579932827,
                2574680422
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/4.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4283658320,
                4283658320
              ]
            }
          }
        },
        {
          "id": 5010,
          "name": "空即是色",
          "desc": "铅丹尽黑而成黑影憧憧,唯青金石头光、身光,婆罗树的绿色叶丛明耀依然。",
          "palette": "https://qqpatch.gtimg.cn/static_theme/dunhuang/palette/5.png",
          "mediaPreview": "https://qqpatch.gtimg.cn/static_theme/dunhuang/dialog/5.png",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/5.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/dunhuang/preview/5.png",
          "light": {
            "primaryColor": [
              4281484654
            ],
            "aioInfo": {
              "color": [
                4283590539,
                4284512163,
                4292396704,
                4287193927
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/5.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4281484654,
                4281484654
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4281484654
            ],
            "aioInfo": {
              "color": [
                2572314507,
                2573236131,
                2581120672,
                2575917895
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/dunhuang/5.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4281484654,
                4281484654
              ]
            }
          }
        }
      ]
    },
    {
      "id": 3,
      "name": "精品尝鲜",
      "slogan": "感受色彩活力,定制你的QQ主题",
      "desc": "",
      "mediaPreview": "",
      "themeList": [
        {
          "id": 3,
          "name": "极简白",
          "desc": "默认主题",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/3-simple-white.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/3-simple-white.png",
          "light": {
            "primaryColor": [
              4278229503
            ],
            "aioInfo": {
              "color": [
                4294111986
              ]
            },
            "bubbleInfo": {
              "color": [
                4278229503
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4278216396
            ],
            "aioInfo": {
              "color": [
                4279900698
              ]
            },
            "bubbleInfo": {
              "color": [
                4280690214
              ]
            }
          }
        },
        {
          "id": 1,
          "name": "经典蓝",
          "desc": "",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/1-classic-blue.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/1-classic-blue.png",
          "light": {
            "primaryColor": [
              4278229503
            ],
            "aioInfo": {
              "color": [
                4293587455,
                4294964223,
                4292930559,
                4292274687
              ]
            },
            "bubbleInfo": {
              "color": [
                4278229503
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4278216396
            ],
            "aioInfo": {
              "color": [
                4279900698
              ]
            },
            "bubbleInfo": {
              "color": [
                4280690214
              ]
            }
          }
        },
        {
          "id": 5011,
          "name": "地海蔚蓝",
          "desc": "",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/1.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/1.png",
          "light": {
            "primaryColor": [
              4280861181
            ],
            "aioInfo": {
              "color": [
                4291884031,
                4292143103,
                4294967295
              ],
              "texture": {
                "url": "",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4280861181,
                4280861181
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4279792792
            ],
            "aioInfo": {
              "color": [
                4284648859,
                4281880429,
                4287150024
              ],
              "texture": {
                "url": "",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4279792792,
                4279792792
              ]
            }
          }
        },
        {
          "id": 5012,
          "name": "樱语红粉",
          "desc": "",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/2.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/2.png",
          "light": {
            "primaryColor": [
              4294088642
            ],
            "aioInfo": {
              "color": [
                4294958575,
                4294958575,
                4294180838
              ],
              "texture": {
                "url": "",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4294088642,
                4294088642
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4287716212
            ],
            "aioInfo": {
              "color": [
                4287000443,
                4286012009,
                4286221417
              ],
              "texture": {
                "url": "",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4287716212,
                4287716212
              ]
            }
          }
        },
        {
          "id": 5014,
          "name": "妙手生春",
          "desc": "",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/4.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/4.png",
          "light": {
            "primaryColor": [
              4287924685
            ],
            "aioInfo": {
              "color": [
                4294958775,
                4294749663,
                4289246968,
                4289784750
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/free/1.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4287924685,
                4287924685
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4287398088
            ],
            "aioInfo": {
              "color": [
                4286217846,
                4286143101,
                4283917452,
                4284248686
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/free/1.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4287398344,
                4287398344
              ]
            }
          }
        },
        {
          "id": 5015,
          "name": "夏绿成荫",
          "desc": "",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/5.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/5.png",
          "light": {
            "primaryColor": [
              4280460643
            ],
            "aioInfo": {
              "color": [
                4293262813,
                4284473993,
                4289589932,
                4291165115
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/free/2.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4280460643,
                4280460643
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4278224447
            ],
            "aioInfo": {
              "color": [
                4286417530,
                4282285650,
                4284384096,
                4285565547
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/free/2.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4278224447,
                4278224447
              ]
            }
          }
        },
        {
          "id": 5013,
          "name": "龙行绚烂",
          "desc": "",
          "requirement": 0,
          "palette": "",
          "mediaPreview": "",
          "previewLight": "https://qqpatch.gtimg.cn/static_theme/free/preview/3.png",
          "previewDark": "https://qqpatch.gtimg.cn/static_theme/free/preview/3.png",
          "light": {
            "primaryColor": [
              4294940810
            ],
            "aioInfo": {
              "color": [
                4294953644,
                4294953121,
                4294945433,
                4294963125
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/free/3-light.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4294948219,
                4294940810
              ]
            }
          },
          "dark": {
            "primaryColor": [
              4290989371
            ],
            "aioInfo": {
              "color": [
                4293958506,
                4294943069,
                4294937197,
                4294283366
              ],
              "texture": {
                "url": "https://qqpatch.gtimg.cn/static_theme/free/3-dark.png",
                "opaque": 1,
                "layout": 1,
                "blendMode": 0
              }
            },
            "bubbleInfo": {
              "color": [
                4292177957,
                4290989371
              ]
            }
          }
        }
      ]
    }
  ]
}
ARGB 转 CSS 的演示与通道拆分

打开原文件 index.html

可以在演示里切换样本,或输入自己的整数,看四个字节怎样重新排列。独立演示页可直接打开。

同一个 QQ 色值在三种转换方式下的显示结果

截图来自上面的色值演示。棋盘格让透明度更容易看清,三块色样分别对应正确转换、只取 RGB、把 ARGB 直接交给 CSS。

脚本拆分通道时使用无符号右移,避免最高位为 1 的颜色被当成负数:

const alphaByte = value >>> 24;
const red = (value >>> 16) & 255;
const green = (value >>> 8) & 255;
const blue = value & 255;

每个颜色对象同时保留 argb、argbHex、hex、hex8、rgba、channels 和 css。用于样式时优先取 css 或 hex8;argb 与 argbHex 留给追溯和重新转换。

本地缓存与安装配置的交叉核对

打开原文件 source-manifest.json

用本地缓存交叉核对

Windows QQ 还在当前用户文档目录的 Tencent Files/nt_qq/global/nt_data/Skin 中保存主题配置。本机找到两份有效 JSON,修改时间分别是 2026 年 3 月和 1 月。

两份缓存中重复出现的命名配色,与内置配置一致。它们合计包含 27 个固定条目,故宫和敦煌系列的另外 10 个条目只在内置配置中出现。这里的 presentInCache 只说明某条目出现在配置缓存里,不能据此判断当前界面是否展示、账号是否可用,或在线目录还有哪些主题。

缓存也不该一股脑覆盖内置配置。旧缓存中,系统主题 0 / 1 的浅色背景只有 #F2F2F2;内置配置和较新的缓存保存了四个背景色。规范化数据用 systemThemes 保留内置值,用 cachedSystemThemes 分来源保留缓存值,原始两份 JSON 也一起附上。