brand-intent 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/parser/brandParser.ts +11 -1
package/package.json
CHANGED
package/parser/brandParser.ts
CHANGED
|
@@ -138,6 +138,8 @@ export interface ParsedPhotoLookDef {
|
|
|
138
138
|
duotone?: { shadow: string; highlight: string };
|
|
139
139
|
/** Keys the person cannot change. All others are starting values. */
|
|
140
140
|
fixed: PhotoLookKey[];
|
|
141
|
+
/** Darkest a gradient under light text on a photo may get, 0..100 (%). Absent → no scrim. */
|
|
142
|
+
scrim?: number;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
export interface ParsedCameraDef {
|
|
@@ -1973,7 +1975,7 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
|
|
|
1973
1975
|
if (photoLookDeclared) {
|
|
1974
1976
|
const keys: PhotoLookKey[] = ['saturation', 'contrast', 'warmth', 'fade', 'mono', 'duotone'];
|
|
1975
1977
|
for (const [key, { line }] of Object.entries(photoLookRaw)) {
|
|
1976
|
-
if (key !== 'fixed' && !keys.includes(key as PhotoLookKey)) throw new Error(`${fileName}:${line}: unknown photo-look property "${key}"`);
|
|
1978
|
+
if (key !== 'fixed' && key !== 'scrim' && !keys.includes(key as PhotoLookKey)) throw new Error(`${fileName}:${line}: unknown photo-look property "${key}"`);
|
|
1977
1979
|
}
|
|
1978
1980
|
const int = (key: string, min: number, max: number): number => {
|
|
1979
1981
|
const p = photoLookRaw[key];
|
|
@@ -2021,6 +2023,14 @@ export function parseBrandFile(content: string, fileName: string): ParsedBrand {
|
|
|
2021
2023
|
look.fixed.push(key as PhotoLookKey);
|
|
2022
2024
|
}
|
|
2023
2025
|
}
|
|
2026
|
+
const scrim = photoLookRaw['scrim'];
|
|
2027
|
+
if (scrim) {
|
|
2028
|
+
const m = /^(\d+)%$/.exec(scrim.value);
|
|
2029
|
+
if (!m || Number(m[1]) < 1 || Number(m[1]) > 100) {
|
|
2030
|
+
throw new Error(`${fileName}:${scrim.line}: photo-look scrim must be a percentage from 1% to 100%, got "${scrim.value}"`);
|
|
2031
|
+
}
|
|
2032
|
+
look.scrim = Number(m[1]);
|
|
2033
|
+
}
|
|
2024
2034
|
result.photoLook = look;
|
|
2025
2035
|
}
|
|
2026
2036
|
|