Making a Dark Mode For Your Website

Do you use dark themes or dark mode in your text editor? You can offer website visitors a choice of dark or light modes. Some people prefer using the dark mode because it is easier on their eyes.

Making a Dark Mode For Your Website
Image by PublicDomainPictures from Pixabay

What do you need to create a dark mode?

The only tools you need are HTML, CSS and JavaScript. You can use a button to allow your visitors to select between modes or use media queries that check their operating system for their preference.

Toggle example

Ananay Negoi uses CSS Variables and a button to toggle between light and dark mode. She demonstrates how to build the Dark-Light mode switch.

Level 5 Media Query

Level 5 Media Query checks your operating system for your preference for a light or dark mode. You can use this query to automatically set the mode for each visitor.

Designing for dark mode

When you create a dark mode for your website, it involves more than switching the colors to darker ones. You need to consider how color, fonts, images affect the readability and usability of your website. Your website reflects your brand. You want to think about how a dark mode can affect your brand. Andy Clarke walks you through the steps he took when he created a dark mode version of his website.

Dark Mode Resources

If you want to implement a dark mode design of your website, refer to these resources on how to do it.

Animation Principles for Enhancing UX

With new tools like CSS Animation, JavaScript Libraries and modern browsers, we can easily add animation to our websites. Animation helps you to provide context, give feedback, convey status and delight your users. You can affect color, location, scale, shape, focus and opacity of objects. By learning the principles of animation, you can create deliberate animation that improves the user experience.

Photo by Aline Ponce from Pixabay

12 Principles of Animation

Disney animators, Ollie Johnston and Frank Thomas, first introduced the 12 Principles of Animation in their book, The Illusion of Life: Disney Animation. They examine the process of animation from Disney’s leading animations and provide you with 12 basic animation principles.

What do the 12 principles provide?

  • Realism
  • Context
  • Causality
  • Focus
  • Delight

They also help to create hierarchy and relationships between objects. These principles help you to provide feedback to the user, indicate status and give instructions. One of the first uses of animation on computer screens was the flashing cursor. It tells you that you can start typing and that the computer is working and not frozen. This simple animation conveys information faster than words can.

How to Use Animation Responsibly

When you are deciding to add animation to your user interface, consider the following:

  • Does it add value?
  • Are your behaviors consistent?
  • Is the user interface still functional without it?
  • Is the animation optimized?
  • Do you need it?

Using Animation to Enhance User Experience

At WordCamp Atlanta 2019, Michelle Schulp gave a talk Squash and Stretch and Good UX- Using Animation To Enhance User Experience. She gave a quick overview of the 12 Principles of Animation. Michelle explains the uses of animation and how to use animation responsibly.

More resources on animation

Using SVGs in Your Web Projects

Are you using SVGs in your web projects? Scalable vector graphics can be used as background patterns, icons, logos and illustrations. They look nice and sharp at all screen resolutions. SVGs can have a small file size which helps you to keep your website size smaller and work better.

Using Svgs in your web projects
Image by Gerd Altmann from Pixabay

How do I get started?

It depends. Are you planning on creating your own or using pre-made SVGs? If you want to create your own, check out SVG on the Web. It is a practical guide for creating and manipulating scalable vector graphics. CSS-Tricks walks you through creating a simple SVG and manipulating it using CSS in Using SVG.

Where can I get SVGs to use?

  • SVG For Backgrounds lets you customize and apply a selection of backgrounds.
  • HeroPatterns has a collection of svg background patterns that you can customize for your web projects.
  • HeroIcons creates scalable vector graphic icons that you can customize with CSS.

Add Animation to Your Scalable Vector Graphics

People react and respond to movement. You can animate svgs to draw attention to a specific area. Animate your graphics with CSS or JavaScript.

You can start with the basics and learn how to use CSS to animate your graphics.

Or you can use SVGator, an online tool, that helps you animate scalable vector graphics.

If you prefer JavaScript, you can use Snap.svg, a JavaScript library, for animating your vector graphics.

5 CSS Frameworks For Your Next Project

What CSS Frameworks do you use? A framework like Bootstrap can be customize to suit your needs. Sometimes you have override the standard styles to get the design to work. You may want to use a framework that is flexible and doesn’t make design decisions for you. Here are 5 frameworks that you can use in your next project.

5 CSS Frameworks For Your Next Project
Photo by Shopify Partners from Burst

Pure CSS

Pure.css is small, responsive CSS framework. It allows you to easily create your own styles while providing responsive layout and common UI components. Pure.css is flexible that you can use it with other frameworks like Bootstrap without any issues. Monty Shokeen explains how you can start using [this framework] (https://www.sitepoint.com/introducing-pure-css-lightweight-responsive-framework/) in your next project.

Mini CSS

Mini.css is a minimal and responsive framework. You can quickly change the CSS file to make a custom design. It relies on CSS for the styling, so it won’t conflict with any JavaScript library that you need to use.

Bulma

Bulma is a CSS framework that is based on Flexbox. It is responsive, modular and free. Bulma is easy to learn and customize. You don’t need JavaScript to get started using this framework.

Tailwind CSS

Tailwind CSS is a different from other CSS frameworks. It provides utility classes that make it easy to rapidly build custom user interfaces. Tailwind doesn’t make design decisions for you. You can create a completely custom design without having to overriding a bunch of pre-built classes.

Materialize CSS

Materialize is a modern, responsive framework based on Material Design. You can choose to use the standard version with CSS and JavaScript or the SCSS version. With the Standard version, you can get started right away. The SCSS requires a Sass compiler.

When choosing a framework for your next project, you may want a small and minimal one or something that works with your existing styles. These 5 provide you with different options to help create a custom user experience.

5 Ways to Organize Your CSS

How do you write and organize your CSS? Do you prefer to use a structured method or not? With CSS, you can choose to use an existing method or develop your own. Some CMSes like WordPress have their own styles. When you use them, you need to follow their rules and guidelines.

5 Ways to Organize Your CSS
Photo by Photo Mix from Pixabay

Your styles can get big, messy and convoluted over time. It can be hard to maintain. You don’t know what you can delete or change because you aren’t sure what problems it will cause. Without a method for organizing, it may get harder and harder to keep things straight. You can choose to use BEM, OOCSS, SMACSS, Atomic CSS or build your own.

BEM

BEM is a way of writing CSS created by Yandex. It is a very structured style of writing CSS. BEM has a component-based approach. This approach divides the user interface into separate components. BEM uses the structure of Block, Element and Modifier. It makes development easy and fast to update.

OOCSS

OOCSS (object-oriented CSS) applies principles of object-oriented languages to help you write CSS. It encourages code reuse and makes it easier to maintain. OOCSS uses the object-oriented principle of abstraction to make the code reusable. It helps you to separate visual elements like color, fonts and borders from the content. This separation makes your code easier to update. Especially when you need to change colors, fonts or other branding-related items.

SMACSS

SMACSS is more of a style guide than a CSS architecture. Scalable and Modular Architecture for CSS provides guidelines for writing CSS. This style guide helps you build CSS that is flexible and maintainable. With SMACSS, you create your own rules for writing CSS.

Atomic CSS

Atomic CSS focuses on small, single-purposed classes. You build well-structured HTML templates, so that your changes doesn’t break your design.

Your Own Style

When you build a website on your own or part of a small team, you can choose how you write your CSS. You may combine methods to help solve certain design problems.

How do you choose a method?

It depends. When you are working on your own project, you can choose which one you want to use. When you are working on a project that uses a CSS framework, it may be easier to use the method that the framework uses.

The best way to learn which one you like is to read the documentation and build a project with it. Then, you’ll know when to use these methods.