Skip to content

Commit

Permalink
Show palette with both hardcoded and theme colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Jul 14, 2020
1 parent c71346a commit 0cbe0c1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

.emptyStateTitle {
text-align: center;
margin-top: 8;
margin-bottom: 10;
margin-top: 4;
margin-bottom: 16;
font-size: 14;
color: #2e4453;
}
Expand Down
25 changes: 18 additions & 7 deletions packages/block-library/src/cover/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,23 @@ const Cover = ( {
} = attributes;
const CONTAINER_HEIGHT = minHeight || COVER_DEFAULT_HEIGHT;

const COVER_DEFAULT_PALETTE = {
colors: settings.colors.filter( ( c ) =>
[ 'black', 'white', 'vivid-cyan-blue', 'pale-pink' ].includes(
c.slug
)
),
const DEFAULT_COLORS = [
{
name: __( 'Black' ),
slug: 'black',
color: '#000000',
},
{
name: __( 'White' ),
slug: 'white',
color: '#ffffff',
},
];

const THEME_COLORS_COUNT = 2;
const themeColors = settings.colors.slice( 0, THEME_COLORS_COUNT );
const coverDefaultPalette = {
colors: [ ...DEFAULT_COLORS, ...themeColors ],
};

const { gradientValue } = __experimentalUseGradient();
Expand Down Expand Up @@ -348,7 +359,7 @@ const Cover = ( {
customStyles={ styles }
setColor={ setColor }
onCustomPress={ noop }
defaultSettings={ COVER_DEFAULT_PALETTE }
defaultSettings={ coverDefaultPalette }
shouldShowCustomIndicatorOption={ false }
shouldShowCustomLabel={ false }
/>
Expand Down

0 comments on commit 0cbe0c1

Please sign in to comment.