Files
NapCatQQ/.pnpm-store/v3/files/ae/19faa0f4f2ea164f8bc7df1643073d612e558185fb023d62cfc7ac0ecca2a0a3f0a6f8c7cbcfd94323294e7951357705eaf2ba26888afa7ab9bc65fe4d65a5
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

18 lines
689 B
Plaintext

import { ClassAttributor, Scope, StyleAttributor } from 'parchment';
class ColorAttributor extends StyleAttributor {
value(domNode) {
let value = super.value(domNode);
if (!value.startsWith('rgb(')) return value;
value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
const hex = value.split(',').map(component => `00${parseInt(component, 10).toString(16)}`.slice(-2)).join('');
return `#${hex}`;
}
}
const ColorClass = new ClassAttributor('color', 'ql-color', {
scope: Scope.INLINE
});
const ColorStyle = new ColorAttributor('color', 'color', {
scope: Scope.INLINE
});
export { ColorAttributor, ColorClass, ColorStyle };
//# sourceMappingURL=color.js.map