Skip to content

Commit

Permalink
Update custom-css.md
Browse files Browse the repository at this point in the history
Added updated code snippet for custom unsplash background images
  • Loading branch information
jdnicholas authored Sep 20, 2023
1 parent 7b48340 commit 84b6823
Showing 1 changed file with 16 additions and 29 deletions.
45 changes: 16 additions & 29 deletions docs/en/advanced/custom-css.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,6 @@ body .main-editor-wrapper .cm-editor{
font-family: '<your-font-name here>', <placeholder>;
}
```

### Visualising Line Endings

In case you want to see where your linefeeds are, you can display the pilcrow symbol (¶) at the end of your lines by using the following Custom CSS:

```css
.cm-line:not(:last-child)::after {
content: "";
color: #666;
}
```

![A preview of Zettlr using above snippet](../img/custom_css_pilcrow.png)

!!! warning

The example CSS Code Snippets above have been tested with v3.0.1, but the ones below haven't been updated in some time, so are unlikely to work out of the box.

### Custom Background Images

With the following code, you can make your editor have a different background image everytime you start it. The images are taken from Unsplash.com, a nice site with free photos. It uses the `Source API`, which will simply spit out a different image every time the URL is visited. You can test it out by simply [visiting the page and refreshing a few times](https://source.unsplash.com/random)! Please refer to the [Unsplash Source API reference](https://source.unsplash.com/) for more options (such as using an image of the day).
Expand All @@ -88,42 +70,47 @@ With the following code, you can make your editor have a different background im
```css
/* Enter your custom CSS here */

#editor {
.main-editor-wrapper .cm-editor{
background-color: transparent;
background-image: url('https://source.unsplash.com/random');
background-size: cover;
background-position: center center;
}

body #editor .CodeMirror-sizer, body #editor .CodeMirror-gutter {
body .main-editor-wrapper .cm-editor .cm-content{
background-color: rgba(255, 255, 255, .8);
height: 100%;
}

body.dark #editor .CodeMirror-sizer, body.dark #editor .CodeMirror-gutter {
background-color: rgba(0, 0, 0, .8);
body .main-editor-wrapper .cm-editor{
background-color: rgba(255, 255, 255, .8);
}

#editor .CodeMirror {
background-color: transparent;
body.dark .main-editor-wrapper .cm-editor .cm-content{
background-color: rgba(0, 0, 0, .8);
}
```
*Light Mode*
![A preview of a Zettlr installation using above snippet](../img/custom_css_unsplash_light.png)

![A preview of a Zettlr installation using above snippet](../img/custom_css_unsplash.png)
*Dark Mode*
![A preview of a Zettlr installation using above snippet](../img/custom_css_unsplash_dark.png)

### Visualising Line Endings

In case you want to see where your linefeeds are, you can display the pilcrow symbol (¶) at the end of your lines by using the following Custom CSS:

```css
.CodeMirror-line:not(:last-child)::after {
.cm-line:not(:last-child)::after {
content: "";
color: #666;
}
```

![A preview of Zettlr using above snippet](../img/custom_css_pilcrow.png)

!!! warning

The example CSS Code Snippets above have been tested with v3.0.1, but the ones below haven't been updated in some time, so are unlikely to work out of the box.


### Set a maximum width for the text

If you have a large screen, you may find that lines of your text are very long.
Expand Down

0 comments on commit 84b6823

Please sign in to comment.