From f63841b6c26959a060deaa8ca518d39341aa6654 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 09:05:37 +0000 Subject: [PATCH 1/4] feat: add accent-color style plugin Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/447a4476-450c-4048-997b-4ca7499837c3 Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- registry/dist/plugins/style/accent-color.js | 1 + .../lib/plugins/style/accent-color/index.ts | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 registry/dist/plugins/style/accent-color.js create mode 100644 registry/lib/plugins/style/accent-color/index.ts diff --git a/registry/dist/plugins/style/accent-color.js b/registry/dist/plugins/style/accent-color.js new file mode 100644 index 0000000000..ea9c935292 --- /dev/null +++ b/registry/dist/plugins/style/accent-color.js @@ -0,0 +1 @@ +!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["style/accent-color"]=o():e["style/accent-color"]=o()}(globalThis,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var a in t)e.o(t,a)&&!e.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:t[a]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{plugin:()=>t});const a=()=>{const e=document.createElement("div");e.style.cssText="position:fixed;pointer-events:none;opacity:0;color:AccentColor";document.body.appendChild(e);const o=getComputedStyle(e).color;document.body.removeChild(e);const t=o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!t)return null;const a=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),i=parseInt(t[3]).toString(16).padStart(2,"0");return`#${a}${n}${i}`};const t={name:"style.accentColor",displayName:"使用系统强调色作为主题颜色",description:"将主题颜色设置为操作系统的强调色(Accent Color)",setup:async e=>{const o=a();o&&(e.coreApis.settings.getGeneralSettings().themeColor=o)},commitHash:"9e0c2b5a843d267eb2e7b0b0fe0eafc254774ab1",coreVersion:"2.10.7"};return o=o.plugin})())); diff --git a/registry/lib/plugins/style/accent-color/index.ts b/registry/lib/plugins/style/accent-color/index.ts new file mode 100644 index 0000000000..d46b0dca1c --- /dev/null +++ b/registry/lib/plugins/style/accent-color/index.ts @@ -0,0 +1,27 @@ +import { PluginMetadata } from '@/plugins/plugin' + +const getAccentColor = (): string | null => { + const el = document.createElement('div') + el.style.cssText = 'position:fixed;pointer-events:none;opacity:0;color:AccentColor' + document.body.appendChild(el) + const color = getComputedStyle(el).color + document.body.removeChild(el) + const match = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/) + if (!match) return null + const r = parseInt(match[1]).toString(16).padStart(2, '0') + const g = parseInt(match[2]).toString(16).padStart(2, '0') + const b = parseInt(match[3]).toString(16).padStart(2, '0') + return `#${r}${g}${b}` +} + +export const plugin: PluginMetadata = { + name: 'style.accentColor', + displayName: '使用系统强调色作为主题颜色', + description: '将主题颜色设置为操作系统的强调色(Accent Color)', + setup: async ({ coreApis: { settings } }) => { + const accentColor = getAccentColor() + if (accentColor) { + settings.getGeneralSettings().themeColor = accentColor + } + }, +} From 86223d342d7734fde26ab1c9c22b612492223872 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 09:07:18 +0000 Subject: [PATCH 2/4] fix: handle rgba() color format and update dist Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/447a4476-450c-4048-997b-4ca7499837c3 Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- registry/dist/plugins/style/accent-color.js | 2 +- registry/lib/plugins/style/accent-color/index.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/registry/dist/plugins/style/accent-color.js b/registry/dist/plugins/style/accent-color.js index ea9c935292..d3c41e6840 100644 --- a/registry/dist/plugins/style/accent-color.js +++ b/registry/dist/plugins/style/accent-color.js @@ -1 +1 @@ -!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["style/accent-color"]=o():e["style/accent-color"]=o()}(globalThis,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var a in t)e.o(t,a)&&!e.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:t[a]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{plugin:()=>t});const a=()=>{const e=document.createElement("div");e.style.cssText="position:fixed;pointer-events:none;opacity:0;color:AccentColor";document.body.appendChild(e);const o=getComputedStyle(e).color;document.body.removeChild(e);const t=o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!t)return null;const a=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),i=parseInt(t[3]).toString(16).padStart(2,"0");return`#${a}${n}${i}`};const t={name:"style.accentColor",displayName:"使用系统强调色作为主题颜色",description:"将主题颜色设置为操作系统的强调色(Accent Color)",setup:async e=>{const o=a();o&&(e.coreApis.settings.getGeneralSettings().themeColor=o)},commitHash:"9e0c2b5a843d267eb2e7b0b0fe0eafc254774ab1",coreVersion:"2.10.7"};return o=o.plugin})())); +!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["style/accent-color"]=o():e["style/accent-color"]=o()}(globalThis,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var a in t)e.o(t,a)&&!e.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:t[a]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{plugin:()=>t});const a=()=>{const e=document.createElement("div");e.style.cssText="position:fixed;pointer-events:none;opacity:0;color:AccentColor";document.body.appendChild(e);const o=getComputedStyle(e).color;document.body.removeChild(e);const t=o.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!t)return null;const a=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),i=parseInt(t[3]).toString(16).padStart(2,"0");return`#${a}${n}${i}`};const t={name:"style.accentColor",displayName:"使用系统强调色作为主题颜色",description:"将主题颜色设置为操作系统的强调色(Accent Color)",setup:async e=>{const o=a();o&&(e.coreApis.settings.getGeneralSettings().themeColor=o)},commitHash:"9e0c2b5a843d267eb2e7b0b0fe0eafc254774ab1",coreVersion:"2.10.7"};return o=o.plugin})())); diff --git a/registry/lib/plugins/style/accent-color/index.ts b/registry/lib/plugins/style/accent-color/index.ts index d46b0dca1c..7290bf22d5 100644 --- a/registry/lib/plugins/style/accent-color/index.ts +++ b/registry/lib/plugins/style/accent-color/index.ts @@ -6,7 +6,8 @@ const getAccentColor = (): string | null => { document.body.appendChild(el) const color = getComputedStyle(el).color document.body.removeChild(el) - const match = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/) + // Match both rgb() and rgba() formats returned by browsers + const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/) if (!match) return null const r = parseInt(match[1]).toString(16).padStart(2, '0') const g = parseInt(match[2]).toString(16).padStart(2, '0') From 10e6fb76ac80512608bdcac250b1cdc7bca99d0c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 09:25:18 +0000 Subject: [PATCH 3/4] fix: guard AccentColor with CSS.supports() check to avoid incorrect fallback Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/d26e3c7b-87c0-46a4-ad4b-63b0d9909714 Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- registry/dist/plugins/style/accent-color.js | 2 +- registry/lib/plugins/style/accent-color/index.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/registry/dist/plugins/style/accent-color.js b/registry/dist/plugins/style/accent-color.js index d3c41e6840..3332144a95 100644 --- a/registry/dist/plugins/style/accent-color.js +++ b/registry/dist/plugins/style/accent-color.js @@ -1 +1 @@ -!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["style/accent-color"]=o():e["style/accent-color"]=o()}(globalThis,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var a in t)e.o(t,a)&&!e.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:t[a]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{plugin:()=>t});const a=()=>{const e=document.createElement("div");e.style.cssText="position:fixed;pointer-events:none;opacity:0;color:AccentColor";document.body.appendChild(e);const o=getComputedStyle(e).color;document.body.removeChild(e);const t=o.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!t)return null;const a=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),i=parseInt(t[3]).toString(16).padStart(2,"0");return`#${a}${n}${i}`};const t={name:"style.accentColor",displayName:"使用系统强调色作为主题颜色",description:"将主题颜色设置为操作系统的强调色(Accent Color)",setup:async e=>{const o=a();o&&(e.coreApis.settings.getGeneralSettings().themeColor=o)},commitHash:"9e0c2b5a843d267eb2e7b0b0fe0eafc254774ab1",coreVersion:"2.10.7"};return o=o.plugin})())); +!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["style/accent-color"]=o():e["style/accent-color"]=o()}(globalThis,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var a in t)e.o(t,a)&&!e.o(o,a)&&Object.defineProperty(o,a,{enumerable:!0,get:t[a]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},o={};e.d(o,{plugin:()=>t});const a=()=>{if(!CSS.supports("color","AccentColor"))return null;const e=document.createElement("div");e.style.cssText="position:fixed;pointer-events:none;opacity:0;color:AccentColor";document.body.appendChild(e);const o=getComputedStyle(e).color;document.body.removeChild(e);const t=o.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!t)return null;const a=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),i=parseInt(t[3]).toString(16).padStart(2,"0");return`#${a}${n}${i}`};const t={name:"style.accentColor",displayName:"使用系统强调色作为主题颜色",description:"将主题颜色设置为操作系统的强调色(Accent Color)",setup:async e=>{const o=a();o&&(e.coreApis.settings.getGeneralSettings().themeColor=o)},commitHash:"9e0c2b5a843d267eb2e7b0b0fe0eafc254774ab1",coreVersion:"2.10.7"};return o=o.plugin})())); diff --git a/registry/lib/plugins/style/accent-color/index.ts b/registry/lib/plugins/style/accent-color/index.ts index 7290bf22d5..1df95176b8 100644 --- a/registry/lib/plugins/style/accent-color/index.ts +++ b/registry/lib/plugins/style/accent-color/index.ts @@ -1,6 +1,9 @@ import { PluginMetadata } from '@/plugins/plugin' const getAccentColor = (): string | null => { + if (!CSS.supports('color', 'AccentColor')) { + return null + } const el = document.createElement('div') el.style.cssText = 'position:fixed;pointer-events:none;opacity:0;color:AccentColor' document.body.appendChild(el) From f48ed12df25183555f37f554c731d891f9bb7791 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 09:31:54 +0000 Subject: [PATCH 4/4] fix: fix ESLint errors (prefer-destructuring and curly) Agent-Logs-Url: https://github.com/BlockG-ws/b23-evolved/sessions/513f94c1-ac6d-4f86-ace6-7f754400e46e Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- registry/lib/plugins/style/accent-color/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registry/lib/plugins/style/accent-color/index.ts b/registry/lib/plugins/style/accent-color/index.ts index 1df95176b8..32e0ddac77 100644 --- a/registry/lib/plugins/style/accent-color/index.ts +++ b/registry/lib/plugins/style/accent-color/index.ts @@ -7,11 +7,13 @@ const getAccentColor = (): string | null => { const el = document.createElement('div') el.style.cssText = 'position:fixed;pointer-events:none;opacity:0;color:AccentColor' document.body.appendChild(el) - const color = getComputedStyle(el).color + const { color } = getComputedStyle(el) document.body.removeChild(el) // Match both rgb() and rgba() formats returned by browsers const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/) - if (!match) return null + if (!match) { + return null + } const r = parseInt(match[1]).toString(16).padStart(2, '0') const g = parseInt(match[2]).toString(16).padStart(2, '0') const b = parseInt(match[3]).toString(16).padStart(2, '0')