• Stars
    star
    8,137
  • Rank 4,333 (Top 0.09 %)
  • Language
    CSS
  • License
    MIT License
  • Created about 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A drop-in collection of CSS styles to make simple websites just a little nicer

NPM page On Product Hunt Contributors MIT license


Water.css

🌊 A drop-in collection of CSS styles to make simple websites just a little nicer

Water.css


Goals

  • Responsive
  • Themeable
  • Good browser support (works on my old kindle's browser :P)
  • Tiny size
  • Beautiful
  • No classes

Why?

I commonly make quick demo pages or websites with simple content. For these, I don't want to spend time styling them but don't like the ugliness of the default styles.

Water.css is a CSS framework that doesn't require any classes. You just include it in your <head> and forget about it, while it silently makes everything nicer.

Who?

You might want to use Water.css if you're making a simple static page or demo website that you don't want to spend time styling.

Although it originally wasn't built for more complex websites, many developers have used Water.css as a base stylesheet and creatively applied custom styles to build out an entire app. Nothing is stopping you from doing the same!

How?

Just stick this in your <head>:

πŸŒ™/β˜€ Automatic Theme:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css">

πŸŒ™ Dark Theme:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.min.css">

β˜€ Light Theme:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/light.min.css">


A preview of the different themes is available on the demo page! ⚑

How the "Automatic Theme" works

The main water.css file automatically switches between light and dark mode depending on the system preferences of a user's device. This detection is made possible through a CSS media query called prefers-color-scheme. In browsers where the preference can't be detected, water.css will stick to the light theme.

If you want to avoid this behavior, use either dark.css or light.css.

Supporting Internet Explorer

All three distributions of Water.css support Internet Explorer 11, but the main water.css file doesn't respect the user's color scheme and will be locked to light mode due to lack of prefers-color-scheme support.

Be aware that IE also doesn't support runtime theming, and fixed fallback values will be used. If you want to override the Water.css theme in a way that's compatible with IE, we recommend that you compile your own theme.

Unminified builds

All versions are also available as unminified stylesheets, which can be handy during development.
Simply remove the .min from the file name.

Theming

Do you want to make some adjustments or build your own theme completely different from the official dark or light themes? Since Water.css is built with CSS variables this is super easy to do! Here's a list list of all the variables you can change to your liking:

  • --background-body
  • --background
  • --background-alt
  • --selection
  • --text-main
  • --text-bright
  • --text-muted
  • --links
  • --focus
  • --border
  • --code
  • --animation-duration
  • --button-hover
  • --scrollbar-thumb
  • --scrollbar-thumb-hover
  • --form-placeholder
  • --form-text
  • --variable
  • --highlight
  • --select-arrow

Runtime theming

⚠ If you use a version with support for legacy browsers like Internet Explorer, skip to Compiling your own theme!

Water.css uses Custom Properties ("CSS variables") to define its base styles such as colors. These can be changed and overwritten right in the browser.

Because of this, you can simply add your own stylesheet to the page and set your own CSS variables there. As long as your stylesheet comes after Water.css in the HTML, your values will override the default ones and your theme is applied!

This short example will use Water.css, but color all links red:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/water.css@2/out/water.min.css" />
<style>
  :root {
    --links: red;
  }
</style>

If you want to change a value for dark or light mode only, use a media query like this:

<style>
  :root {
    --links: blue; /* Always applied */
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --links: yellow; /* Only applied in dark mode (overrides blue) */
    }
  }
</style>

Compiling your own theme

If you are targeting browsers without support for CSS Custom Properties such as Internet Explorer, runtime theming is not an option. To apply your own theming, you'll need to make your changes in the source files themselves, then re-compile the CSS files. This works like the following:

  • Clone the repository to your machine
  • Run yarn to install dependencies
  • Make the theming changes you want in src/variables-*.css
  • Run yarn build to compile the CSS files
  • Use the compiled files in the out/ directory on your site

You also might want to check out the Contributing Guide as it contains further information about the build setup.

Contributing

Water.css becomes better for everyone when people like you help make it better!

Check out our Contributing Guide to learn how to get started.
And thanks for taking the time to contribute! :)

More Repositories

1

arpchat

Answering the question nobody asked: what if you wanted to text your friends using only ARP?
Rust
2,443
star
2

obsidian-atom

A theme for Obsidian based on Atom's One family
CSS
201
star
3

among-js

An Among Us client written in TypeScript
TypeScript
114
star
4

stalker

A thing that watches everything everything I do. Currently deactivated because it makes less sense now that I have a job.
TypeScript
72
star
5

repl.it-mobile

A mobile app for Repl.it
JavaScript
70
star
6

overengineering

a webring of interesting people
Rust
52
star
7

volcano

A shitty plugin loader for Obsidian
JavaScript
40
star
8

repl.it-api

A Node.js client for creating projects and executing code on Repl.it.
JavaScript
38
star
9

volcano-plugins

Community created plugins for Obsidian
JavaScript
28
star
10

obsidian-aviation

Clean Markdown files for FAR/AIM and more
CSS
20
star
11

crypticat

Dead simple encrypted chat
TypeScript
20
star
12

website

My personal website and portfolio.
Astro
19
star
13

dotfiles

My NixOS config, quite fresh so not that fancy.
Nix
18
star
14

p2psc

Point to point secure chat
JavaScript
17
star
15

next-barebones-template

A very basic opinionated React + Next.js template for the sake of convenience.
TypeScript
11
star
16

sirtet

Tetris, but absolutely abominable
JavaScript
11
star
17

portal

Project portal deployments
JavaScript
10
star
18

aoc2021

Advent of Code 2021 solutions! Beware of horrifying code
JavaScript
9
star
19

swanki

[Prototype] Talk to your Anki flashcard deck
TypeScript
9
star
20

vatsim-multiproxy

A simple CoC-friendly packet sniffing local proxy server.
JavaScript
8
star
21

omegle-skipper

Finds interesting people on omegle
JavaScript
8
star
22

sherlock

Fast and efficient multi-threaded, cross-platform file searching.
Python
8
star
23

frozone

A React framework that generates entirely static HTML with no JavaScript
TypeScript
8
star
24

flight-plan-converter

Simple website to convert flight plans between different formats
TypeScript
7
star
25

atc-discordrp

Nice Discord rich presences for virtual air traffic controllers.
JavaScript
7
star
26

s1

A barebones database, if you can call it that
Go
7
star
27

git-yoink

Git utility for a Golang-inspired directory structure.
JavaScript
6
star
28

repl.it-node

Easily upload and deploy your projects to REPL.it.
JavaScript
6
star
29

monch

A library for easily manipulating bits and bytes in JavaScript
TypeScript
6
star
30

taut

The best selfbot for Slack
JavaScript
5
star
31

kognise

Itsa meeee!
5
star
32

neocel

A command-line tool to deploy static sites to Neocities
JavaScript
5
star
33

s1-node

An S1 client for Node.js
JavaScript
5
star
34

bootstrap-next

Quickly and easily bootstrap a Next.js project.
JavaScript
5
star
35

styled-jsx-theming

An opinionated theming library for your Styled-JSX projects
TypeScript
5
star
36

quest-chroma

A Quest port of the popular Beat Saber Chroma mod for PC.
C++
4
star
37

kogs-in-town

It's like Bands in Town, but custom-made for me!
TypeScript
4
star
38

silencer

A Discord bot to disconnect people who talk
JavaScript
4
star
39

oogle

An open-source clone of the Google search engine and crawler infrastructure
3
star
40

mplighting

A beat saber quest mod which enables lighting (including chromalite/rainbow) in multiplayer.
C++
3
star
41

blaggy

Fast, simple, and speedy blagging for the interblag with NodeJS!
HTML
3
star
42

s1-connect

A simple session store for Express and Connect using S1
JavaScript
3
star
43

neocities-deploy-action

A GitHub Action to deploy static sites to Neocities
Dockerfile
3
star
44

encryptico

Easy-peasy encryption, decryption, and signing using a simple, beautiful web interface and top-of-the-line cryptography techniques.
JavaScript
3
star
45

vscode-upm

Repl.it's amazing package manager workflow in Visual Studio Code
JavaScript
3
star
46

media

Branding, media, and assets
3
star
47

colab

JavaScript
3
star
48

repltools

An extension to aid developing around Repl.it
JavaScript
3
star
49

greetings

hi hello
JavaScript
3
star
50

updog

What's up, dog?
2
star
51

ctfbot

A simple Discord bot for playing hacking CTFs
JavaScript
2
star
52

pot

A pot full of delicious honey
JavaScript
2
star
53

eve-discordrp

An application to add Discord rich presence support to EVE Online.
JavaScript
2
star
54

avigraph

Rust
2
star
55

stackbit-test

CSS
2
star
56

pwnhost

Simple and reliable personal hosting for any application
JavaScript
2
star
57

mint-cleanup

Moves Citibank transaction names to Intuit Mint, and recategorizes some transactions.
JavaScript
2
star
58

digitalgov-workflow-react

My remake of the Digital.gov Workflow site in React, using Next.js
JavaScript
2
star
59

globule

TypeScript
2
star
60

unhealthy-and-unsafe

A Beat Saber mod for the Quest that just skips the health and safety screen when the game starts.
C++
2
star
61

bored

A nice and simple optionally anonymous message board
JavaScript
1
star
62

M_Lib

A php library which at the moment has multiple file uploads, error handlers as well as multiple file upload with two type sorting.
PHP
1
star
63

crosscomp-mcve

Nix
1
star
64

hello-frozone-netlify

JavaScript
1
star
65

precedence

HTML
1
star
66

sky-safety-weight-and-balance

TypeScript
1
star
67

chromectl

A POC for something special, don't mind this
JavaScript
1
star
68

actions-lol

1
star
69

fish

Just a little phishing site created for educational purposes
JavaScript
1
star
70

stackbit-test-2

JavaScript
1
star
71

glutin-weirdness-mcve

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Rust
1
star
72

digitalgov-workflow-graphql

The backend for digitalgov-workflow-react.
JavaScript
1
star
73

test-react-app

Begin app
JavaScript
1
star
74

gameshow

Outernet 2023: whack-a-mole and Osu!Mania with giant red buttons from Aliexpress
HTML
1
star
75

hello-frozone-ghp

JavaScript
1
star
76

s1-dashboard

A dashboard for S1
TypeScript
1
star
77

cfcf

Chipflake, Chipflake!
JavaScript
1
star
78

NothingOS

1
star
79

s1-clicker

A clicker made with Next.js and S1
JavaScript
1
star
80

simple-next-app

JavaScript
1
star
81

led-matrix-driver-rp2040

Raspberry Pi Pico W firmware that drives some weird Adafruit LED matrices
Rust
1
star
82

golfed-cursor-sync

very codegolfed (albeit depends on ws) server that provides synchronized cursors
1
star
83

hello-frozone-now

JavaScript
1
star