Learn MOAR with Summer ’21: Branding Websites in Experience Cloud :

Learn MOAR with Summer ’21: Branding Websites in Experience Cloud
by:
blow post content copied from  Salesforce Developers Blog
click here to view original post


Follow and complete a Learn MOAR Summer ’21 trailmix for Admins or Developers by July 31 to earn a special community badge and enter for a chance to win one of five $200 USD Salesforce Certification vouchers. Learn how to participate and review the Official Rules by visiting the Trailhead Quests page.

SF-Learn-MOAR-Su21-Social-Ad-1200x628@2x-100.jpg

There are a lot of challenges to build an attractive and engaging business website. Among many things, the website needs to be fast, accessible on a variety of devices, and properly represent your brand in an appealing way. For many companies, branding on the web is easier said than done. Do you create an entire design system for your brand? How do you implement that design system with reusable components? How do you make sure that those components follow best user experience and accessibility standards?

At Salesforce, we want to make it easy to build web experiences that consistently match your brand. We provide an out-of-the-box design system with base components that follow best practices. And we’ve exposed an API to make it easy to change the design system to match your brand.

The color palette

Within the Experience Cloud builder, you can adjust the four simple color properties for the entire page, or any section within the page. When one of these color values is defined, other colors are subsequently derived and mapped to the individual base components.

For example, if you change the brand color from the default blue to peachpuff (#ffdab9) associated brand colors on all base components will be updated. But notice, many colors come in pairs, a background color and an associated foreground color. It is important that both colors contrast for accessibility. If we change the brand foreground color to darkred, it now properly contrasts.

There are other colors derived from the brand color, often to style the separate states of the base components. For example, the hover state of a button is derived from the base brand color.

Scoped branding

On most websites, it is very common to have sections on a page that adjust basic branding colors. For example, maybe a header has a dark background, with a light foreground, whereas the rest of the site does the opposite.

We’ve made it easy to adjust these colors on any section. Just select a section, and pick an existing or define an entirely new color palette. We’ve made it easy to adjust these colors on any section. Just select a section, and pick an existing or define an entirely new color palette.

Further customization

Underneath the hood, Experience Cloud uses the Salesforce Lightning Design System (SLDS). SLDS uses styling hooks for base components. Styling hooks use CSS custom properties, which are variables within your CSS that cascade to all descendants within the scope of a selector. For example, the lightning-button component uses the styling hook --sds-c-button-color-background to change its background color. You can define the hook in any selector.

<style>
  /**
   * Scoped to the root of the document and all its descendant elements.
   */
  :root {
    --sds-c-button-color-background: peachpuff;
  }

  /**
   * Scoped to any element with the class applied and all its descendant elements
   */
  .container {
    --sds-c-button-color-background: peachpuff;
  }
</style>

SLDS provides a lot of styling hooks with fine-grain control for how each base component looks. When our branding defaults aren’t exactly what you want, you can easily define any of these custom properties as necessary.

Learn more about branding in Lightning Web Runtime for Experience Cloud.

The post Learn MOAR with Summer ’21: Branding Websites in Experience Cloud appeared first on Salesforce Developers Blog.


May 20, 2021 at 09:40PM
Click here for more details...

=============================
The original post is available in Salesforce Developers Blog by
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce