From 18d811b822eb31bfd6be036170dc776b8cbe3cfe Mon Sep 17 00:00:00 2001 From: intergrav Date: Wed, 07 May 2025 17:02:06 +0000 Subject: [PATCH] init --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ demo.html | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 26 ++++++++++++++++++++++++++ slight.css | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 file(s) changed, 333 insertion(s)(+), 0 deletion(s)(-) diff --git a/README.md b/README.md new file mode 100644 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# slight.css + +**slight.css** is an incredibly simple CSS stylesheet that adds some _slight_ enhancements on top of the default user agent stylesheet. + +it aims to provide a more pleasant reading experience while relying mostly on native browser styles. things such as background and text colors are chosen by the browser. + +this can be used as a good baseline for any web project, or as-is for a super barebones website/blog. + +## how do i use it? + +### html import + +place this somewhere in your ``: + +``` + +``` + +### css import + +place this somewhere in your stylesheet: + +``` +@import url(https://cdn.jsdelivr.net/npm/@intergrav/slight.css@1); +``` + +### npm package + +run this in your terminal, **replace with the proper command**: + +``` +[npm/yarn/pnpm/bun] add @intergrav/slight.css +``` + +## what exactly does it change? + +1. automatically adjusts the color scheme based on system preferences +2. uses the default system sans-serif/monospace fonts +3. sets a maximum width for the body content on widescreen viewports (reverted when printing) +4. increases line height and changes tab size +5. adds borders and padding to table elements for better spacing and clarity +6. adds a border to inline code and code blocks for better readability +7. makes blockquotes look a bit nicer with a border and padding +8. displays lists in nav horizontally when placed in header + +keep in mind that mostly relying on the user agent stylesheet means that things could possibly look different on other browsers. for certain projects, this may matter, and you might want to look into using a CSS reset/normalize stylesheet such as [modern-normalize](https://github.com/sindresorhus/modern-normalize). + +## can i see what it looks like? + +yes! there is a demo available at [slightcss.devins.page](https://slightcss.devins.page). keep in mind that it may look different depending on the browser you use. + +## difference between this and dev.css? + +i maintain and use both, but this is a much more simple alternative to dev.css that mainly focuses on improving default user agent stylesheets rather than having a full custom set of styles. slight.css is more limited as it has less built-in element styles and doesn't have custom theme support (although you can apply your own stylesheets on top). it may also be less consistent across browsers. diff --git a/demo.html b/demo.html new file mode 100644 --- /dev/null +++ b/demo.html @@ -0,0 +1,146 @@ + + + + + + slight.css + + + +
+

slight.css

+ +
+

+ slight.css is an incredibly simple CSS stylesheet that + adds some slight enhancements on top of the default user agent + stylesheet. +

+

+ it aims to provide a more pleasant reading experience while relying mostly + on native browser styles. things such as background and text colors are + chosen by the browser. +

+

+ this can be used as a good baseline for any web project, or as-is for a + super barebones website. +

+

+ the page that you are currently viewing is using slight.css as its + stylesheet. +

+

how do i use it?

+

html import

+

Place this somewhere in your head:

+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@intergrav/slight.css@1">
+

css import

+

Place this somewhere in your stylesheet:

+
@import url(https://cdn.jsdelivr.net/npm/@intergrav/slight.css@1);
+

npm package

+

+ Run this in your terminal, + replacing with the proper command: +

+
[npm/yarn/pnpm/bun] add @intergrav/slight.css
+

what exactly does it change?

+
    +
  1. + automatically adjusts the color scheme based on system preferences +
  2. +
  3. uses the default system sans-serif/monospace fonts
  4. +
  5. sets a maximum width for the body content on widescreen viewports
  6. +
  7. increases line height and changes tab size
  8. +
  9. + adds borders and padding to table elements for better spacing and + clarity +
  10. +
  11. + adds a border to inline code and code blocks for better readability +
  12. +
  13. makes blockquotes look a bit nicer with a border and padding
  14. +
  15. displays lists in nav horizontally when placed in header
  16. +
+

+ keep in mind that mostly relying on the user agent stylesheet means that + things could possibly look different on other browsers. for certain + projects, this may matter, and you might want to look into using a CSS + reset/normalize stylesheet such as + modern-normalize. +

+

demo elements

+

blockquote

+
+

+ congue ex inceptos ut est gravida purus. convallis suspendisse mattis + porta metus mus nisl ad ante eros inceptos. iaculis convallis gravida + odio venenatis ut velit. fames non nunc sollicitudin dictumst litora + natoque consectetur erat. fermentum mattis arcu quam sociosqu libero + tincidunt pellentesque rutrum. pulvinar per habitasse fusce nec bibendum + tempor natoque efficitur si. +

+
a really cool person
+
+

table

+ + + + + + + + + + + + + + + + + + + + + +
+ table caption +
header 1header 2header 3
row 1row 1row 1
row 2row 2row 2
+

code

+

+ this is normal text, while this is inline code marked with + code tag. +

+

code block (pre+code)

+
this is a code block
+	this is a line of code, indented with tab
+	this is another line of code, indented with tab
+beep boop
+

difference between this and dev.css?

+

+ i maintain and use both, but this is a much more simple alternative to + dev.css that mainly focuses on improving default user agent stylesheets + rather than having a full custom set of styles. slight.css is more limited + as it has less built-in element styles and doesn't have custom theme + support (although you can apply your own stylesheets on top). it may also + be less consistent across browsers. +

+ + + diff --git a/package.json b/package.json new file mode 100644 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "@intergrav/slight.css", + "version": "1.0.0", + "description": "minimal enhancements for the user agent stylesheet", + "keywords": [ + "css", + "stylesheet", + "framework", + "classless", + "minimal", + "lightweight", + "open-source" + ], + "homepage": "https://slightcss.devins.page", + "bugs": { + "url": "https://github.com/intergrav/slight.css/issues" + }, + "license": "MIT", + "author": "intergrav (https://devins.page)", + "files": [], + "main": "slight.css", + "repository": "github:intergrav/slight.css", + "prettier": { + "useTabs": true + } +} diff --git a/slight.css b/slight.css new file mode 100644 --- /dev/null +++ b/slight.css @@ -0,0 +1,107 @@ +/* slight.css | + minimal enhancements on top of the user agent stylesheet + provides a pleasant reading experience while relying mostly on native browser styles + can be used as a baseline for web projects or minimal websites/blogs +*/ + +/* toc | + 1. variables + 2. typography + 3. elements + 4. remove max-width when printing +*/ + +/* 1. variables */ + +:root { + /* customizable variables - you may change these as you wish */ + --sc-font: system-ui, sans-serif; + --sc-font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, + Consolas, "DejaVu Sans Mono", monospace; + /* unsafe variables - not recommended to customize, may be removed or changed in the future */ + color-scheme: light dark; + --sc-emphasizebd: light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2)); + --sc-emphasizebg: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1)); +} + +/* 2. typography */ + +html { + font-family: var(--sc-font); + line-height: 1.5; + tab-size: 4; +} + +body { + max-width: 48rem; + margin: auto; + padding: 1rem; +} + +code, +kbd, +samp, +pre { + font-family: var(--sc-font-mono); + font-size: 0.9rem; +} + +/* 3. elements */ + +table { + border-collapse: collapse; +} + +th, +td { + border: 1px solid var(--sc-emphasizebd); + padding: 0.25rem 0.5rem; +} + +thead tr, +tbody tr:nth-child(even) { + background-color: var(--sc-emphasizebg); +} + +:not(pre) > code, +:not(pre) > samp, +:not(pre) > kbd, +pre { + background-color: var(--sc-emphasizebg); +} + +pre { + overflow-x: auto; + max-width: 100%; + padding: 0.5rem; +} + +blockquote { + border-left: 4px solid var(--sc-emphasizebd); + padding-left: 1rem; + margin-left: 0; +} + +header nav ul { + display: flex; + flex-wrap: wrap; + list-style: none; + padding: 0; +} + +header nav ul li:not(:first-child)::before { + content: "•"; + margin: 0 0.25em; +} + +header nav ul li { + margin: 0; + display: flex; +} + +/* 4. remove max-width when printing */ +@media print { + body { + max-width: revert; + } +} -- tangled.sh