Skip to content

tin-pham/Clock-Theme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSS

  • About theme change, just use CSS variable. I mean var() not the $ of Sass, because CSS variable not translate to hard code, it just var for itself

  • Set var in the :root

:root {
  --primary: black;
  --second: white;
}
  • After that combine body with some class and change the value of css variable
body.dark {
  --primary: white;
  --second: black;
}

JavaScript

  • Hour (from 0 to 11), minute and second (0 to 59) take that and use scale function to map that range of number to circle degree (0 to 360) that way we can make the tick point to exact ratio

  • scale function

function scaleRange(number, inMin, inMax, outMin, outMax) {
  return ((number - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
}

Screenshot

Light Theme

Dark Theme

Live Site

URL: Link

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published