extractColorsFromVueSection
从Vue文件的某个section中提取颜色。
函数签名
typescript
function extractColorsFromVueSection(
section: VueSection,
filePath: string,
options?: VueProcessingOptions
): ColorReference[]
interface VueSection {
type: VueSectionType
content: string
startLine: number
endLine: number
}参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
section | VueSection | 是 | Vue文件的section对象 |
filePath | string | 是 | 文件路径 |
options | VueProcessingOptions | 否 | 处理选项 |
返回值
| 类型 | 说明 |
|---|---|
ColorReference[] | 提取到的颜色引用数组 |
工作原理
根据section类型使用不同的提取策略:
- template: 从HTML属性和文本中提取颜色
- script: 从JavaScript代码中提取颜色值
- style: 从CSS代码中提取颜色
适用于从Vue文件的特定部分提取颜色引用。