Sublime Forum

Sidebar background color

#1

Hi,
Is there a way , I can set a gradient as a sidebar background color ? If yes, can you please show me how ? I am using the latest dev version of ST 3.

Thanks
Gagan

0 Likes

#2

I guess you would need to create your desired gradient as an image and use that

0 Likes

#3

Script to generate a gradient :

import numpy as np
import cv2

# Increase for resolution
resolution = 100

# Choose your colors
color1 = (84, 40, 46)
color2 = (52, 61, 70)

canva = np.ones([1, resolution, 4])
canva[0, :, 3] = 255
for i in range(resolution):
        # CV2 is BGR not RGB
        canva[0, i, 0] = (color1[2] * (resolution - i) + color2[2] * i) / resolution
        canva[0, i, 1] = (color1[1] * (resolution - i) + color2[1] * i) / resolution
        canva[0, i, 2] = (color1[0] * (resolution - i) + color2[0] * i) / resolution

# Choose path and write
imPath = "path/to/your/image.png"
cv2.imwrite(imPath, canva)

Then in your .sublime-theme replace:

{
    "class": "sidebar_container",
    "layer0.texture": "path/to/your/image.png",
    "layer0.opacity": 1,
},

Result:

1 Like