Browser extensions - our first theme

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
Search for a command to run...

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.
No comments yet. Be the first to comment.
We already looked at our first extension that didn't have a view and a custom theme. Now let's look at how we can make a new tab extension. The idea behind these is that they replace the new tab with a webpage we created. The result will be a new tab...
Most of you know me for my consistency, a golden arrow in my blog series. I've written 1000 articles in 1008 days! Almost an article a day, and my honeymoon was the only holiday I ever took. I'm super proud of this achievement; it has been a fantasti...

It's not the first time I'll be talking about community. I think it's an essential aspect of any successful tool. This shows in my previous explorations of Astro, Medusa, and now Vendure as well. All these products thrive in a super open, welcoming, ...

The cool part about Vendure is how easy it is to set up and how abstract each layer is. Basically, we get the following elements: External database Server Worker Admin UI Frontend While this is amazing, it also brings a bit of complexity when it co...

The previous article looked at customizing Vendure on a data and process level. In this article, we'll look at customizing emails, as they are often a big part of a webshop system. We'll be looking at two different layers of customization for customi...

Even though Vendure is a pretty significant project out of the box, in some cases, we might want to go in and modify some elements to work to our specific use case. In this article, I'll take a high-level look at some elements we can customize within...

In the previous article, we looked at creating our very first browser extension.
For this article, we'll be looking into making our very first theme as an extension!
The process will be very similar but easier.
As mentioned, the structure for a theme is easier.
We can use a manifest.json and additionally add some images.
Start by creating a new folder.
mkdir theme-extension && cd theme-extension
Then you can go ahead and add the manifest.json file.
I'll paste the full version of my manifest, and then we'll go into more detail on each option.
{
"manifest_version": 3,
"version": "2.6",
"name": "daily dev tips theme",
"theme": {
"images": {
"theme_frame": "images/frame-background.png",
"theme_frame_overlay": "images/frame-background.png",
"theme_tab_background": "images/tab-background.png",
"theme_ntp_background" : "images/ntp-background.png"
},
"colors" : {
"toolbar" : [0, 185, 232],
"tab_background_text": [255, 255, 255],
"tab_text": [255, 255, 255],
"bookmark_text": [255,255,255],
"ntp_text" : [218, 0, 96],
"ntp_link" : [218, 0, 96],
"ntp_section" : [255, 255, 255],
"ntp_background": [255, 255, 255]
},
"tints" : {
"buttons" : [1, 1, 1]
},
"properties" : {
"ntp_logo_alternate": 0,
"ntp_background_alignment" : "center"
}
}
}
Alright, let's go ahead and analyze each option. First, it's good to note that the color options are in RGB format.
I've added this color reference image, so people can visualize what each option affects.

Images:
theme_frame: We can't set a color for the outer frame, but you can pick a 1x1 pixel image.theme_frame_overlay: It's the left top corner. I went for the same as the frame.theme_tab_background: This indicates the non-active tabs; again, we have to use an image to color these.theme_ntp_background: The actual center bit of the screen.Colors:
toolbar: The color of the bookmark element on the new tab (bottom left corner)tab_background_text: Color of the text of the background tabstab_text: Color of the active tabbookmark_text: Color of the bookmarked itemsntp_text: Color of the center frame textntp_link: Color of links inside the center framentp_section: Color of the quick links in the center sectionntp_background: Background of the new tab pageTints:
buttons: The tint color for the icons inside the toolbar (back, refresh, etc.)Properties:
ntp_logo_alternate: Which logo to show, 0 is the colorful Google logo and 1 is the white Google logontp_background_alignment: If you added an NTP image, you can adjust the positionYou can style many more small elements, and I found the following GitHub repo to be super helpful.
We don't want to publish to the stores without testing our extension, so let's see what it takes to try it locally.
I prefer to use Chrome as it has a quicker interface for it.
In Chrome, click the plugins button and open up that page.

Next, toggle the developer mode on. You'll get another menu where you get the option to load unpacked extensions.
Click the load unpacked and navigate to the theme-extension folder.
Chrome will notify you that your theme is now active, and you should immediately see the colors in effect.
I also added my daily dev tips theme to GitHub. You can download it and install it via developer mode in Chrome.
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter