Compare commits
4 Commits
0bccda2c01
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b18ef4ea4c | ||
|
|
04d7c76e2f | ||
|
|
672e0e7c63 | ||
|
|
d91a8eb341 |
@@ -147,6 +147,13 @@ impl Baseline {
|
||||
settings: &Arc<SchemeSetting>,
|
||||
is_dark: bool,
|
||||
) -> Self {
|
||||
// Ensure neutral_lightest has higher lightness than neutral_darkest, swap if necessary
|
||||
let (neutral_lightest, neutral_darkest) = if neutral_lightest.l >= neutral_darkest.l {
|
||||
(*neutral_lightest, *neutral_darkest)
|
||||
} else {
|
||||
(*neutral_darkest, *neutral_lightest)
|
||||
};
|
||||
|
||||
let (final_secondary, final_tertiary, final_accent) = match settings.expand_method {
|
||||
ColorExpand::Complementary => {
|
||||
let sec_color = secondary.cloned().or(Some(primary.complementary()));
|
||||
@@ -209,7 +216,7 @@ impl Baseline {
|
||||
} else {
|
||||
neutral_lightest.l
|
||||
};
|
||||
let neutral_swatch = Arc::new(NeutralSwatch::new(*neutral_lightest, *neutral_darkest));
|
||||
let neutral_swatch = Arc::new(NeutralSwatch::new(neutral_lightest, neutral_darkest));
|
||||
let outline_color = neutral_swatch.get(if is_dark { 0.25 } else { 0.7 });
|
||||
let outline_variant_color = neutral_swatch.get(if is_dark { 0.2 } else { 0.8 });
|
||||
let shadow_color = neutral_swatch.get(0.1);
|
||||
@@ -308,13 +315,13 @@ impl Baseline {
|
||||
let (foreground, background) = if is_dark {
|
||||
// Dark mode: foreground = neutral_lightest, background = neutral_darkest with +10% lightness
|
||||
let background_darkest = Oklch {
|
||||
l: (neutral_darkest.l * 1.2).min(1.0),
|
||||
..*neutral_darkest
|
||||
l: (neutral_darkest.l * 1.3).min(1.0),
|
||||
..neutral_darkest
|
||||
};
|
||||
(*neutral_lightest, background_darkest)
|
||||
(neutral_lightest, background_darkest)
|
||||
} else {
|
||||
// Light mode: foreground = neutral_darkest, background = neutral_lightest
|
||||
(*neutral_darkest, *neutral_lightest)
|
||||
(neutral_darkest, neutral_lightest)
|
||||
};
|
||||
|
||||
Self {
|
||||
|
||||
@@ -148,7 +148,7 @@ impl SchemeExport for QScheme2 {
|
||||
collection.push(format!("--color-{key}: light-dark(#{light}, #{dark});"));
|
||||
}
|
||||
(Some(color), None) | (None, Some(color)) => {
|
||||
collection.push(format!("--color-{key}: #{color}"));
|
||||
collection.push(format!("--color-{key}: #{color};"));
|
||||
}
|
||||
(None, None) => {}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { capitalize, keys } from 'lodash-es';
|
||||
import { capitalize, isArray, keys } from 'lodash-es';
|
||||
import { FC, ReactNode, useMemo } from 'react';
|
||||
import { useColorFunction } from '../../../ColorFunctionContext';
|
||||
import { ScrollArea } from '../../../components/ScrollArea';
|
||||
@@ -127,11 +127,12 @@ const PreviewBlock: FC<PreviewBlockProps> = ({ baseline, title }) => {
|
||||
<PreviewLine name="Neutral Variant" unit={baseline.neutralVariant} />
|
||||
</div>
|
||||
<div className={styles.preview_surface}>
|
||||
{baseline.surface.map((surfaceSet, index) => (
|
||||
<div className={styles.surface_block} key={index}>
|
||||
<PreviewLine key={index} name={`Surface ${index + 1}`} unit={surfaceSet} />
|
||||
</div>
|
||||
))}
|
||||
{isArray(baseline.surface) &&
|
||||
baseline.surface.map((surfaceSet, index) => (
|
||||
<div className={styles.surface_block} key={index}>
|
||||
<PreviewLine key={index} name={`Surface ${index + 1}`} unit={surfaceSet} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className={styles.preview_indi_block}>
|
||||
<PreviewCell bg={baseline.shadow} fg={baseline.neutralVariant.onRoot}>
|
||||
@@ -140,10 +141,10 @@ const PreviewBlock: FC<PreviewBlockProps> = ({ baseline, title }) => {
|
||||
<PreviewCell bg={baseline.overlay} fg={baseline.neutralVariant.onRoot}>
|
||||
Overlay
|
||||
</PreviewCell>
|
||||
<PreviewCell bg={baseline.outline} fg={baseline.surface.onRoot}>
|
||||
<PreviewCell bg={baseline.outline} fg={baseline.foreground}>
|
||||
Outline
|
||||
</PreviewCell>
|
||||
<PreviewCell bg={baseline.outlineVariant} fg={baseline.surface.onRoot}>
|
||||
<PreviewCell bg={baseline.outlineVariant} fg={baseline.foreground}>
|
||||
Outline Variant
|
||||
</PreviewCell>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ColorExpand, ColorShifting, SchemeSetting, WACGSetting } from 'color-module';
|
||||
import { ColorExpand, ColorShifting, SchemeSelect, SchemeSetting, WACGSetting } from 'color-module';
|
||||
import { every, isEmpty, isNil } from 'lodash-es';
|
||||
import { useActionState, useMemo } from 'react';
|
||||
import { useColorFunction } from '../../../ColorFunctionContext';
|
||||
@@ -53,6 +53,7 @@ export function QSchemeBuilder({ scheme, onBuildCompleted }: QSchemeBuilderProps
|
||||
),
|
||||
scheme.schemeStorage.source?.setting?.expand_method ?? defaultValues.expand_method,
|
||||
scheme.schemeStorage.source?.setting?.wacg_follows ?? defaultValues.wacg_follows,
|
||||
scheme.schemeStorage.source?.setting?.scheme_select ?? defaultValues.scheme_select,
|
||||
);
|
||||
return defaultValues;
|
||||
} catch (e) {
|
||||
@@ -103,6 +104,7 @@ export function QSchemeBuilder({ scheme, onBuildCompleted }: QSchemeBuilderProps
|
||||
),
|
||||
Number(formData.get('expanding')) as ColorExpand,
|
||||
Number(formData.get('wacg')) as WACGSetting,
|
||||
SchemeSelect.Both,
|
||||
);
|
||||
const dumpedSetting = schemeSetting.toJsValue() as QSchemeSetting;
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user