# 3.0: Colors

## GENERAL INTRO

CSS is a stylesheet language that describes the presentation of an HTML (or XML) document. CSS describes how elements must be rendered on screen, on paper, or in other media.

CSS(CSS3) — CSS stands for *Cascading Style Sheet* it is used for styling web pages, with the help of css, you can style web pages, websites, etc..

W3.css — w3.css is a CSS framework, built for responsive web design like bootstrap. That means you can create responsive websites with the help of w3.css. *Hope it will help you…*

## Part 3.0: COLORS

A big part of a successful website is how it looks to the user. Styling goes beyond where you place items on your site. We will be exploring colors more in depth. When thinking about color, you need to keep in mind the target audience, accessabilty and psychology.

We will cover:

```
Color Theory
HSL
Transparency
Gradients
```

### COLORS

We know that colors can be defined by name (Maroon), Hexadecimal and RGB values. Another value to expand color choices is HSL and Transparency.

Example: dark red

```
#8000
Maroon
rgb(128,0,0)
rgba(128,0,0,1.0)
hsl(0,100%,13%)
hsla(0,100%, 13%, 1.0)
```

![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_xgGzTOIWeJCTEHG%2FOpacOriginal.PNG?generation=1524706570729085\&alt=media)

Opacity property applies to element AND all of its children. This can make the text inside a fully transparent element hard to read:

```
background: rgb(128,0,0);
opacity: 0.6;
```

![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_xjDxjjPEyvVY783%2FOpacity.PNG?generation=1524706571407068\&alt=media)

a(alpha) has no impact on other css properties or descendants. The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).

```
background: rgb(128, 0, 0, 0.6 )
```

![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_xm9MiiZuIzGiY5T%2FOpacRGB.PNG?generation=1524706571912908\&alt=media)

Any text in halfopaque div will be 50% opaque while text in halfalpha div will be black/only background color of that single element will be slightly opaque (background-color is not inherited property(?))

Example:

```
div.halfopaque {
  background-color: rgb(0, 0, 0);
  opacity: 0.5;
  color: #000000;
}

div.halfalpha {
  background-color: rgba(0, 0, 0, 0.5);
  color: #000000;
}
```

#### HSL/HSLA

**Hue, Lightness and Saturation (Alpha)**

HSL mimics the way humans perceive color. It is intuitive and is quicker and easier to make changes\* ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_xrc9dP_U8vdlPSq%2FColorsHSL.PNG?generation=1524706570276737\&alt=media)

```
H = Hue (0-359)
    0(or 360) is red
    120 is green
    240 blue
S = Saturation (%, 100% = full saturation)
L = Lightness (%, 100% = light/white, 50% = norm, 0% = dark/black)
```

#### Color Theory

![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_xvEFIDGC8Z2l8_h%2FRGBWheel.PNG?generation=1524706571408369\&alt=media) ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_xvFazw2rp6BGgZ6%2FColorWheel.PNG?generation=1524706569104612\&alt=media)

**Color Wheels** - showing the relationship between primary, secondary, and tertiary colors

```
Primary (for our purposes: red, blue, green)
Primary colors are the main colors in a given color system.

Secondary (Orange, Green, Violet)
Secondary colors are made by mixing two primary colors in a color system.

Tertiary (Red-Orange, Yellow-Orange, Yellow-Green, Blue-Green, Blue-Purple, Red-Purple)
Tertiary colors are made by mixing two secondary colors in a color system.
```

Black on white is the default web color scheme. White on black is often preferred for smaller devices.

\*\*White on black requires less energy (battery life) on most display technologies.

The importance of color in design is because of accessability, target audience, and human psychology.

### Schemes

**Color Scheme** - logical combinations of colors/purpose to create anaesthetic feeling of style and appeal.

Monochromatic - use only one color using different tones, but same hue. ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAznC4ywqwqHW0w4VXo%2F-LAznDDAfUZmgAtqBom2%2FMonochromatic.PNG?generation=1524710042536229\&alt=media)

Analogous - using colors that are next to each other on the color wheel. ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAznC4ywqwqHW0w4VXo%2F-LAznDE6w1vCq36GVBWy%2FAnalogous.PNG?generation=1524710042548774\&alt=media)

Complementary - combining colors from opposite sides of wheel. ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAznC4ywqwqHW0w4VXo%2F-LAznDFAp5AFB1zkiF2E%2FComplementary.PNG?generation=1524710042526342\&alt=media)

Triadic - made up of hues equally spaced around the wheel. ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_y-osVZpmVpmD-DU%2FTriadic.PNG?generation=1524706569628712\&alt=media)

Compound - uses colors on both sides of the opposite hue. ![colors](https://1195190411-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfmXOY6zd_cRgsE%2F-LAz_vtNIe86O92-LRrI%2F-LAz_y1bxaq4mumimMmN%2FCompound.PNG?generation=1524706570246469\&alt=media)

#### Resources:

<https://www.w3schools.com/colors/colors_schemes.asp>

<https://css-tricks.com/almanac/properties/o/opacity/>
