Skip to content

Commit

Permalink
change(colors): introduced css variables for primary colors #247
Browse files Browse the repository at this point in the history
- Css variables for main colors such as themes, text, border and background colors.
  This way we can override them  from a designated class such as content-box which
  colors the section given it's theme color
  • Loading branch information
ichim-david authored Oct 5, 2022
2 parents 3d1b844 + 1f5262a commit ac80825
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 45 deletions.
2 changes: 1 addition & 1 deletion theme/themes/eea/collections/breadcrumb.variables
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@
/*-------------------
States
--------------------*/
@activeColor: @tertiaryColor;
@activeColor: @textColor;
@activeFontWeight: @normal;
2 changes: 1 addition & 1 deletion theme/themes/eea/collections/table.variables
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************
Table
*******************************/
@tableHoverBackgroundColor: #F9F9F9;
@tableHoverBackgroundColor: @backgroundColorCSSVar;

/*-------------------
Element
Expand Down
12 changes: 0 additions & 12 deletions theme/themes/eea/definitions/views/item.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,6 @@
/*--------------
Item
---------------*/
// color item images that are svg files
.item.primary img {
filter: @itemPrimaryFilterColor;
}

.item.secondary img {
filter: @itemSecondaryFilterColor;
}

.item.tertiary img {
filter: @itemTertiaryFilterColor;
}

.ui.items > .item:after {
display: block;
Expand Down
3 changes: 3 additions & 0 deletions theme/themes/eea/elements/input.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
max-width: 100%;
}

.accordion-title:not(.active) .ui.input input {
color: @textColorCSSVar;
}
.ui.input input {
border: @border;

Expand Down
12 changes: 6 additions & 6 deletions theme/themes/eea/elements/list.variables
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@imageAlign: top;

/* Item */
@itemColor: @primaryColor;
@itemColor: @textColorCSSVar;

/* Content */
@contentDistance: 0.5em;
Expand All @@ -58,7 +58,7 @@
/* Header */
@itemHeaderFontFamily: @headerFont;
@itemHeaderFontWeight: @bold;
@itemHeaderColor: @textColor;
@itemHeaderColor: @textColorCSSVar;

/* Description */
@itemDescriptionColor: rgba(0, 0, 0, 0.7);
Expand Down Expand Up @@ -170,19 +170,19 @@

@bulletOpacity: 1;
@bulletCharacter: '•';
@bulletColor: @primaryColor;
@bulletLinkColor: @primaryColor;
@bulletColor: @textColorCSSVar;
@bulletLinkColor: @primaryColorCSSVar;
@bulletVerticalAlign: top;
@bulletChildDistance: @bulletDistance;

/* Horizontal Bullets */
@horizontalBulletColor: @primaryColor;
@horizontalBulletColor: @textColorCSSVar;
@horizontalBulletSpacing: @bulletDistance + 0.5em;

/* Ordered List */
@orderedCountName: ordered;
@orderedCountContent: counters(ordered, ".") " ";
@orderedCountColor: @primaryColor;
@orderedCountColor: inherit;
@orderedCountDistance: 1.25rem;
@orderedCountOpacity: 1;
@orderedCountTextAlign: right;
Expand Down
6 changes: 3 additions & 3 deletions theme/themes/eea/extras/callout.variables
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Callout
*******************************/
/* Body */
@mobileCalloutBorderLeft : @5px solid @secondaryColor;
@tabletCalloutBorderLeft : @10px solid @secondaryColor;
@mobileCalloutBorderLeft : @5px solid @borderColorSecondaryCSSVar;
@tabletCalloutBorderLeft : @10px solid @borderColorSecondaryCSSVar;

/* Text */
@quoteColor : @japaneseIndigo;
@quoteColor : @textColorCSSVar;
@mobileQuoteFontSize : 1rem;
@tabletQuoteFontSize : @h6;
@computerQuoteFontSize : @h5;
Expand Down
19 changes: 13 additions & 6 deletions theme/themes/eea/extras/contentBox.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
padding-top: @contentBoxContainerMarginTop;
padding-bottom: @contentBoxContainerMarginBottom;
position: relative;
z-index: 1;
}

&.primary {
Expand All @@ -46,15 +45,23 @@
}
}

[class*="content-box"] a {
text-decoration: underline;
}
.content-box[class*="ary"] {
--bg-color: transparent;
--border-color-secondary: #FFF;
--text-color: #FFF;
--text-color-hover: @grey-1;
--text-color-primary: #FFF;
--text-color-secondary: #FFF;
--text-color-tertiary: #FFF;
--text-color-hover: @backgroundColorSupplementary;
}
// inherit link
.content-box[class*="ary"] a {
.content-box[class*="ary"] a:not(.ui, .item) {
color: inherit;
text-decoration: underline;
}

// inherit color for slate links within context boxes
.content-box .slate-editor-link {
color: inherit;
text-decoration: underline;
}
24 changes: 20 additions & 4 deletions theme/themes/eea/extras/custom.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,32 @@
font-weight: inherit;
}

// inherit color for slate links within context boxes
.content-box .slate-editor-link {
color: inherit;
}

// customize error class from volto-slate to our color of red
.error {
color: @red-5;
}

.power-user-menu,
.blocks-chooser {
--text-color: @textColor;
}
.blocks-chooser {
.searchbox {
height: auto !important;
}
.input {
width: auto !important;
}
.clear-search-button {
padding: 0.5rem;
}
.icon {
margin-right: 0 !important;
}
}


// ensure background of content-box goes above the content area
// draft image for non published pages
.view-viewview:not(.wf-state-published) .content-area {
Expand Down
4 changes: 2 additions & 2 deletions theme/themes/eea/extras/quote.variables
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@tabletQuotePadding : 0.5rem 0 1rem;

/* Source */
@sourceTextColor : @secondaryColor;
@sourceTextColor : @secondaryColorCSSVar;
@sourceTextAlign : right;
@sourceFontWeight : @bold;
@sourceFontSize : 1.25rem;
Expand All @@ -30,5 +30,5 @@
/* Icon */
@mobileQuoteIconSize : 2rem;
@tabletQuoteIconSize : 3rem;
@quoteIconColor : @secondaryColor;
@quoteIconColor : @secondaryColorCSSVar;
@quoteDownIconFloat : right;
2 changes: 1 addition & 1 deletion theme/themes/eea/extras/tag.variables
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/* Tag text */
@tagNameFontSize : 1rem;
@tagNameFontColor : @japaneseIndigo;
@tagNameFontColor : @textColorCSSVar;
@tagNameFontColorWithBackground : @white;
@tagNameFontWeight : 500;
@tagNameLineHeight : 1.25rem;
Expand Down
2 changes: 1 addition & 1 deletion theme/themes/eea/extras/tagList.variables
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@tagsBodyWidth : 100%;

/* Tags Title */
@tagsTitleFontColor : @japaneseIndigo;
@tagsTitleFontColor : @textColorCSSVar;
@tagsTitleMargin : 1rem;
@tagsFontWeight : 400;
@tagsFontSize : 1.125rem;
Expand Down
13 changes: 13 additions & 0 deletions theme/themes/eea/globals/site.variables
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@
--------------------*/

@primaryColor : @darkCerulean;
@primaryColorCSSVar : var(--text-color-primary, @primaryColor);
@secondaryColor : @pineGreen;
@secondaryColorCSSVar : var(--text-color-secondary, @secondaryColor);
@tertiaryColor : @deepBlue;
@tertiaryColorCSSVar : var(--text-color-tertiary, @tertiaryColor);

@lightPrimaryColor : @mediumPersianBlue;
@lightSecondaryColor : @darkCyan;
Expand Down Expand Up @@ -181,7 +184,17 @@
@lineHeight : @font-lineheight-3;
@mobileLineHeight : @font-lineheight-3;
@textColor : @tertiaryColor;
// use this variable when you want it to be replaced by css variables
@textColorCSSVar : var(--text-color, @textColor);
@borderColorCSSVar : var(--border-color, @grey-3);
@borderColorPrimaryCSSVar: var(--border-color-primary, @primaryColor);
@borderColorSecondaryCSSVar: var(--border-color-secondary, @secondaryColor);
@borderColorTertiaryCSSVar: var(--border-color-tertiary, @tertiaryColor);
@contentAreaColor : @tertiaryColor;
@backgroundColor: @grey-0;
@backgroundColorCSSVar: var(--bg-color, @backgroundColor);
@backgroundColorSupplementary: @grey-1;
@backgroundColorSupplementaryCSSVar: var(--bg-color-supplementary, @backgroundColorSupplementary);

/*-------------------
Paragraph
Expand Down
6 changes: 3 additions & 3 deletions theme/themes/eea/modules/accordion.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
}
.ui.accordion.primary .title:not(.active):hover,
.ui.accordion.primary .title:not(.active):hover i {
color: @primaryColor;
color: @primaryColorCSSVar;
}

/* Secondary */
Expand All @@ -131,7 +131,7 @@
}
.ui.accordion.secondary .title:not(.active):hover,
.ui.accordion.secondary .title:not(.active):hover i {
color: @secondaryColor;
color: @secondaryColorCSSVar;
}

/* Tertiary */
Expand All @@ -140,5 +140,5 @@
}
.ui.accordion.tertiary .title:not(.active):hover,
.ui.accordion.tertiary .title:not(.active):hover i {
color: @tertiaryColor;
color: @tertiaryColorCSSVar;
}
8 changes: 4 additions & 4 deletions theme/themes/eea/modules/accordion.variables
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@titlePadding: 1rem 1.563rem;
@titlePadding: @rectangleMedium;
@titleFontSize: 1.125rem;
@titleColor: var(--text-color, @textColor);
@titleColor: @textColorCSSVar;
@titleBorderBottom: @1px solid @silverGray;
@titleColorHover:var(--text-color-hover, @grey-5);
@titleJustifyContent: space-between;
Expand All @@ -32,7 +32,7 @@
;
@iconVerticalAlign: baseline;
@iconTransform: none;
@iconColorHover: @grey-5;
@iconColorHover: @titleColorHover;
@iconInactive: "\ea4e"; // Icon of closed accordion
@iconActive: "\EA78"; // Icon of open accordion
@iconOrder: 1; // Icon after text of the title
Expand Down Expand Up @@ -63,7 +63,7 @@
--------------------*/

@activeIconTransform: none;
@activeTitleBackground: @white;
@activeTitleBackground: var(--bg-color, @white);
@activeTitleColor: @grey-5;
@activeTitleBorderBottom: 0;

Expand All @@ -73,7 +73,7 @@

/* Styled */
@styledWidth: 600px;
@styledBackground: @white;
@styledBackground: @activeTitleBackground;
@styledBorderRadius: 0;
@styledBoxShadow: none;

Expand Down
13 changes: 13 additions & 0 deletions theme/themes/eea/views/item.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@
}
}

// color item images that are svg files
.item.primary img {
filter: @itemPrimaryFilterColor;
}

.item.secondary img {
filter: @itemSecondaryFilterColor;
}

.item.tertiary img {
filter: @itemTertiaryFilterColor;
}

// decrease margin when using icons instead of images
// since the icons have themselves extra whitespace
// and we should aim to get about 32px as seen in the figma design
Expand Down
2 changes: 1 addition & 1 deletion theme/themes/eea/views/item.variables
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
@descriptionMaxWidth: auto;
@descriptionFontSize: 1em;
@descriptionLineHeight: @lineHeight;
@descriptionColor: @textColor;
@descriptionColor: @textColorCSSVar;

/* Content Image */
@contentImageWidth: '';
Expand Down

0 comments on commit ac80825

Please sign in to comment.