Skip to content

Commit

Permalink
feat:adjust graphin default style
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Jan 31, 2021
1 parent 8991ad4 commit f0b08be
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions packages/graphin/src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NodeStyle } from '.';
import { ComboStyle, EdgeStyle } from './typings/type';
import hexToRgba from './utils/hexToRgba';

// interface ColorSetType {
// activeFill: string;
Expand Down Expand Up @@ -62,7 +61,7 @@ export const DEFAULT_THEME = {
primaryColor: '#269a99', // '#3D76DD',
nodeSize: 26,
edgeSize: 1,
edgePrimaryColor: '#ddd',
edgePrimaryColor: '#AAB7C4',
background: '#fff',
};

Expand Down Expand Up @@ -111,8 +110,11 @@ export const genDefaultNodeStyle = ({
}) => {
const Colors = {
light: {
fill: hexToRgba(primaryColor, '0.1'),
fill: primaryColor,
fillOpacity: 0.1,
stroke: primaryColor,
strokeOpacity: 1,

icon: primaryColor,
badge: {
fill: primaryColor,
Expand All @@ -123,8 +125,10 @@ export const genDefaultNodeStyle = ({
disabled: '#ddd',
},
dark: {
fill: hexToRgba(primaryColor, '0.3'),
fill: primaryColor,
fillOpacity: 0.3,
stroke: primaryColor,
strokeOpacity: 1,
icon: '#fff',
badge: {
fill: primaryColor,
Expand All @@ -144,17 +148,20 @@ export const genDefaultNodeStyle = ({
keyshape: {
size: [nodeSize, nodeSize],
fill: Color.fill,
stroke: Color.stroke,
fillOpacity: Color.fillOpacity,
stroke: Color.stroke, // storke is primaryColor
strokeOpacity: Color.strokeOpacity,
lineWidth: 1,
opacity: 1,
type: 'circle',
},
label: {
position: 'bottom',
value: '',
value: 12,
fill: Color.label,
fontSize: labelSize,
offset: 0,
background: undefined,
},
icon: {
type: 'text',
Expand All @@ -164,7 +171,9 @@ export const genDefaultNodeStyle = ({
offset: [0, 0],
},
badges: [],
halo: {},
halo: {
visible: false,
},
},
status: {
selected: {
Expand Down Expand Up @@ -247,22 +256,21 @@ export const genDefaultEdgeStyle = ({ edgeSize = 1, edgePrimaryColor = '#ddd', m
type: 'line',
lineWidth: edgeSize,
stroke: Color.stroke,
opacity: 1,
strokeOpacity: 1,
lineAppendWidth: 9,
cursor: 'pointer',
},
halo: {
stroke: Color.stroke,
opacity: 0.4,
// stroke: Color.stroke,
visible: false,
cursor: 'pointer',
strokeOpacity: 0.4,
},
label: {
value: '',
position: 'top',
fill: Color.label,
fontSize: '',
fontFamily: '',
fontSize: 12,
textAlign: 'center',
},
},
Expand Down Expand Up @@ -327,7 +335,7 @@ export const getDefaultStyleByTheme = (inputTheme: Partial<ThemeType> | undefine
const isLight = theme.mode === 'light';
return {
...theme,
background: isLight ? '#fff' : '#000',
background: isLight ? '#fff' : '#1f1f1f',
...genDefaultNodeStyle(theme),
...genDefaultEdgeStyle(theme),
...genDefaultComboStyle(),
Expand Down

0 comments on commit f0b08be

Please sign in to comment.