diff --git a/docs/browsers.md b/docs/browsers.md index 7776ee64c..705c369df 100644 --- a/docs/browsers.md +++ b/docs/browsers.md @@ -3,38 +3,19 @@ > [!NOTE] > If you see a popular browser that hasn't been added, please create a pull request to do so! -Find your browser version by following the link for your browser. +**To find your browser's version:** +- Find your browser in the table below and follow the matching link to visit the page with the version. + - *Chrome/Chromium*: the version should be the first entry in the table that appears. There is a copy to clipboard button after the version number which you can use. + - *Firefox*: the version is under the "Application Basics" section in the row labeled "Version". + +|Browser|Version| +|---|---| +|Chromium|`chrome://version/`| +|Firefox|`about:support`| +|Opera (GX)|`opera://about/`| +|Microsoft Edge|`edge://version/`| +|Arc|`arc://version/`| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BrowserURL
Chromiumchrome://version/
Firefoxabout:support
Opera (GX)opera://about/
Microsoft Edgeedge://version/
Arcarc://version/
## Common Issues diff --git a/docs/tips-and-tricks.md b/docs/tips-and-tricks.md new file mode 100644 index 000000000..38d58d167 --- /dev/null +++ b/docs/tips-and-tricks.md @@ -0,0 +1,122 @@ +

+

📖 Tips and tricks for writing a userstyle

+

+ +  + +### How can I see my changes in real time? + +See [Stylus Wiki - Initial installation and live reload](https://github.com/openstyles/stylus/wiki/Writing-UserCSS#initial-installation-and-live-reload). + +  + +### How can I hide sensitive information in preview screenshots? + +When taking screenshots of userstyles, you may want to hide sensitive information (such as your username, email, etc.). + +You may use the [Flow Circular](https://fonts.google.com/specimen/Flow+Circular) font to redact details by obscuring any text on the page. + +Use this snippet at the top of your userstyle to import and use the font: + +```less +@import url('https://fonts.googleapis.com/css2?family=Flow+Circular&display=swap'); + +* { + font-family: 'Flow Circular', cursive; +} +``` + +  + +### How do I convert preview images to WebP? + +The Catppuccin project prefers to use the [WebP image format](https://en.wikipedia.org/wiki/WebP) for the asset preview images. We recommend using Google's [`cwebp`](https://developers.google.com/speed/webp/docs/cwebp) conversion utility to convert images to WebP. + +#### Installation + +| Method | Instructions | +| ------------------------------------- | -------------------------------------------------------------------------------------- | +| [Homebrew](https://brew.sh/) | `brew install webp` [[view cask]](https://formulae.brew.sh/formula/webp) | +| [MacPorts](https://www.macports.org/) | `sudo port install webp` [[view port]](https://ports.macports.org/port/webp/) | +| Binaries | See https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html. | + +#### Usage + +> [!TIP] +> See [the full documentation on `cwebp`](https://developers.google.com/speed/webp/docs/cwebp) for further reference. + +``` +cwebp -lossless old-image.png -o new-image.webp +``` + +The command above is converting the input image `old-image.png` to the output file `new-image-webp`, with a lossless quality conversion. + +  + +### How do I theme images and SVGs? + +#### SVG background images + +Often, websites will use a CSS rule to apply an SVG as a `background-image` (typically for icons). We will refer to these as "external SVGs" throughout the rest of this guide. Below is an example of what a rule for an external SVG could look like. + +```css +.xyz { + background-image: url("https://example.org/assets/xyz.svg"); +} +``` + +The easiest way to theme external SVGs is to visit the URL of the SVG and paste its contents in between the single quotes of the `escape('')` section of the following template: + +```less +.xyz { + @svg: escape("..."); + background-image: url("data:image/svg+xml,@{svg}"); +} +``` + +Now, replace any colors in the SVG with their respective Catppuccin variants. For example, take the following SVG icon for Twitter: + +```xml + +``` + +There is only one color used, `fill="#1D9BF0"`. That hex code is a shade of blue, so we can replace it with the `@blue` color using the `fill="@{}"` syntax. + +```less +.twitter-icon { + @svg: escape( + '' + ); + background-image: url("data:image/svg+xml,@{svg}"); +} +``` + +#### `` elements + +Theming an inline image is a bit tricky. We have to first hide the original image with `height: 0 !important;` and `width: 0 !important;`, after which we can apply our own background image. Importantly, you must determine the height and width of the original image. You will need the width and height to A) adjust the SVG to that size (you can use https://www.svgviewer.dev/ for this), and B) the `padding-left: _px !important;` and `padding-right: _px !important` also need to use those dimensions. You can use the template below for this. + +```less +img.xyz { + @svg: escape("..."); + height: 0 !important; + width: 0 !important; + padding-left: px !important; + padding-top: px !important; + background: url("data:image/svg+xml,@{svg}") no-repeat !important; +} +``` + +Again, following the example of theming a Twitter logo: + +```less +img.twitter-icon { + @svg: escape( + '' + ); + height: 0 !important; + width: 0 !important; + padding-left: 24px !important; + padding-top: 24px !important; + background: url("data:image/svg+xml,@{svg}") no-repeat !important; +} +```