Skip to content

Instantly share code, notes, and snippets.

@RyanGreenup
Last active February 7, 2022 16:17
Show Gist options
  • Save RyanGreenup/2e01fdaa500f5cca4694421db167bfb2 to your computer and use it in GitHub Desktop.
Save RyanGreenup/2e01fdaa500f5cca4694421db167bfb2 to your computer and use it in GitHub Desktop.
Implementing Custom and Persistent CSS for Notable

Custom CSS in Notable

Tue 21 Jan 2020 08:20:34 PM

Custom CSS can be used in Notable by using the ! important specification in the CSS.

First download and extract the .AppImage with: 1

wget https://github.com/notable/notable/releases/download/v1.8.3/Notable-1.8.3.AppImage
chmod +x ./Notable-1.8.3.AppImage
./Notable-1.8.3.AppImage --appimage-extract

Make sure that you've set up npm globally with nvm, in order to start using the newest node execute:

exec bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
nvm install node
nvm use node

Install the asar tool with: 2

npm install -g asar

Traverse into the directory, make a subdirectory and extract by using the extract parameter: 3

cd squashfs-root/resources/ ; mkdir extractedAppAsar
asar extract app.asar extractedAppAsar/
 cd extractedAppAsar/

This should give you something to the effect of:

.
├── main
│   ├── chunk.0c2c065610c5339dc3ff.js
│   ├── main.js
│   └── main.js.LICENSE
├── package.json
├── renderer
│   ├── 0.renderer.css
│   ├── 11.renderer.css
│   ├── 1.renderer.css
│   ├── chunk.0bcec0fa00f9b8c09b9f.js
│   ├── fonts
│   │   ├── KaTeX_AMS-Regular--fonts.woff2
│   ├── index.html
│   ├── renderer.css
│   ├── renderer.js
│   └── renderer.js.LICENSE
└── static
    ├── images
    │   ├── icon.ico
    │   ├── icon.png
    │   └── pointing-clips.svg
    ├── metadata.json
    ├── monaco.worker.js
    ├── quick_modals.json
    └── tutorial.json

Now open your css and replace every ; character with ! important;and/or play around in notable until you make something you're happy with, save this css into the directory as mystyle.css. 4

here's some really obvious css that you can use to test with:

echo "pre { background: #282a36 ; background:  #809cb8  !important; font-weight: 550; border: 3px solid #75327a; font-size: 18px !important; line-height: 21px !important; overflow: auto; padding: 20px 40px !important; border-radius: 20px !important; color: #2d4d6d !important ; }" >> mystyle.css

Append this to renderer.css:

cat mystyle.css >> renderer/renderer.css

Then rebuild it with:

cd ..
rm app.asar
asar pack extractedAppAsar

Now before repacking the AppImage I would recommend testing it by running:

./AppRun

If it worked the app should just pop up and the CSS should be different, if not something's wrong on your end.

Then repackage the AppImage by using the appimagetool: 5

cd ../../../
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-aarch64.AppImage 
./appimagetool-aarch64.AppImage -v squashfs-root

Then test run the app executing it:

 mv ./Notable-x86_64.AppImage MyCssNotable.AppImage
 ./MyCssNotable.AppImage 

This .AppImage can then be integrated into your system by followint the documentation.

Footnotes

  1. App Image user Guide

  2. Electron Tutorial

  3. Akash Nimari, How to get source code of any electron application

  4. in Vim I was able to just use %s/;/! important;/g, you may also want to use sed or sd

  5. StackExchange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment