Skip to content

Commit

Permalink
dependency removed and neon bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zfedoran committed Feb 13, 2022
1 parent 0f78a85 commit cafadb9
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 62 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ No, I don't remember it either, but with this experimental theme we can go there

This theme is a fork of the awesome SynthWave '84 theme. Much thanks to Robb Owen for this.

__As of February 9th 2022, it seems that the glow effect no longer works reliably with the latest release of Visual Code. Stay tuned, we're working on finding the source of the issue.__
__As of v0.1.15, no external extensions or dependencies are needed to activate the glow effect!__

![Neon glowing text](./theme.png)
![Neon glowing text](./theme-neon.png)

This colour scheme is influenced by the Solana homepage and those awesome Sunglasses.

Expand Down Expand Up @@ -70,6 +70,12 @@ I haven't included a font in this release as I know that it's a very personal pr
## Compatibility
This theme is still **very much a work in progress**. I primarily develop in Rust, Go, and Node so, whilst those language sets should look pretty good, there will likely be issues for other languages. I'll work on adding more support as I go. If you find anything glaringly wrong, raise an issue and I'll try to fix it as soon as I can.

## Without Neon
The theme is designed to work without neon enabled. Here is an example.

![Neon glowing text](./theme.png)


## Contributing
I'm really happy to consider any contributions to this theme. Before you make any changes, [please read the contribution guide](https://github.com/zfedoran/solanabeach-vscode/blob/master/CONTRIBUTING.md).

Expand Down
27 changes: 3 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "solanabeach-vscode",
"displayName": "Solana Beach '22",
"description": "A Solana take on the SynthWave '84 theme",
"version": "0.1.14",
"version": "0.1.15",
"author": "Zelimir Fedoran",
"publisher": "zfedoran",
"icon": "icon.png",
Expand All @@ -11,11 +11,10 @@
"url": "https://github.com/zfedoran/solanabeach-vscode"
},
"engines": {
"vscode": "^1.33.0"
"vscode": "^1.64.0"
},
"keywords": [
"solana",
"blockchain",
"solanabeach"
],
"categories": [
Expand Down Expand Up @@ -49,7 +48,7 @@
"properties": {
"solanabeach22.brightness": {
"type": "number",
"default": 0.45,
"default": 0.32,
"description": "Set the brightness value for the glow effect. 0.0 is fully transparent and 1.0 is fully bright"
},
"solanabeach22.disableGlow": {
Expand All @@ -61,6 +60,5 @@
}
},
"dependencies": {
"semver": "^7.1.1"
}
}
17 changes: 8 additions & 9 deletions src/extension.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const path = require('path');
const fs = require('fs');
const vscode = require('vscode');
const diff = require('semver/functions/diff');

/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
this.extensionName = 'ZelimirFedoran.solanabeach-vscode';
this.extensionName = 'zfedoran.solanabeach-vscode';
this.cntx = context;

const config = vscode.workspace.getConfiguration("solanabeach22");
Expand Down Expand Up @@ -36,8 +35,8 @@ function activate(context) {
const templateFile =
base +
(isWin
? "\\electron-browser\\workbench\\solana-solanabeach.js"
: "/electron-browser/workbench/solana-solanabeach.js");
? "\\electron-browser\\workbench\\solanabeach.js"
: "/electron-browser/workbench/solanabeach.js");

try {

Expand All @@ -55,13 +54,13 @@ function activate(context) {
const html = fs.readFileSync(htmlFile, "utf-8");

// check if the tag is already there
const isEnabled = html.includes("solana-solanabeach.js");
const isEnabled = html.includes("solanabeach.js");

if (!isEnabled) {
// delete solanabeach script tag if there
let output = html.replace(/^.*(<!-- SOLANABEACH 22 --><script src="solana-solanabeach.js"><\/script><!-- NEON DREAMS -->).*\n?/mg, '');
let output = html.replace(/^.*(<!-- SOLANABEACH 22 --><script src="solanabeach.js"><\/script><!-- NEON DREAMS -->).*\n?/mg, '');
// add script tag
output = html.replace(/\<\/html\>/g, ` <!-- SOLANABEACH 22 --><script src="solana-solanabeach.js"></script><!-- NEON DREAMS -->\n`);
output = html.replace(/\<\/html\>/g, ` <!-- SOLANABEACH 22 --><script src="solanabeach.js"></script><!-- NEON DREAMS -->\n`);
output += '</html>';

fs.writeFileSync(htmlFile, output, "utf-8");
Expand Down Expand Up @@ -116,11 +115,11 @@ function uninstall() {
const html = fs.readFileSync(htmlFile, "utf-8");

// check if the tag is already there
const isEnabled = html.includes("solana-solanabeach.js");
const isEnabled = html.includes("solanabeach.js");

if (isEnabled) {
// delete solanabeach script tag if there
let output = html.replace(/^.*(<!-- SOLANABEACH 22 --><script src="solana-solanabeach.js"><\/script><!-- NEON DREAMS -->).*\n?/mg, '');
let output = html.replace(/^.*(<!-- SOLANABEACH 22 --><script src="solanabeach.js"><\/script><!-- NEON DREAMS -->).*\n?/mg, '');
fs.writeFileSync(htmlFile, output, "utf-8");

vscode.window
Expand Down
33 changes: 11 additions & 22 deletions src/js/theme_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,23 @@
var updatedThemeStyles = initialThemeStyles;

if (!disableGlow) {

/* replace yellow */
/* replace white */
updatedThemeStyles = updatedThemeStyles.replace(/color: #f4eee4;/g, "color: #f4eee4; text-shadow: 0 0 2px #393a33, 0 0 8px #f39f05[NEON_BRIGHTNESS], 0 0 2px #f39f05[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace green */
//updatedThemeStyles = updatedThemeStyles.replace(/color: #18ef95;/g, "color: #fdfdfd; text-shadow: 0 0 2px #001716, 0 0 3px #03edf9[NEON_BRIGHTNESS], 0 0 5px #03edf9[NEON_BRIGHTNESS], 0 0 8px #03edf9[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace neon red */
//updatedThemeStyles = updatedThemeStyles.replace(/color: #f721ba;/g, "color: #fff5f6; text-shadow: 0 0 2px #000, 0 0 10px #fc1f2c[NEON_BRIGHTNESS], 0 0 5px #fc1f2c[NEON_BRIGHTNESS], 0 0 25px #fc1f2c[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace neon pink */
//updatedThemeStyles = updatedThemeStyles.replace(/color: #c82be0;/g, "color: #f5fff8; text-shadow: 0 0 2px #000, 0 0 10px #1ffc63[NEON_BRIGHTNESS], 0 0 5px #1ffc63[NEON_BRIGHTNESS], 0 0 25px #1ffc63[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace yellow */
//updatedThemeStyles = updatedThemeStyles.replace(/color: #19f99a;/g, "color: #e4f4e5; text-shadow: 0 0 2px #333a36, 0 0 8px #05f32f[NEON_BRIGHTNESS], 0 0 2px #05f33a[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace green */
//updatedThemeStyles = updatedThemeStyles.replace(/color: #18ef95;/g, "color: #fdfdfd; text-shadow: 0 0 2px #001716, 0 0 3px #03edf9[NEON_BRIGHTNESS], 0 0 5px #03edf9[NEON_BRIGHTNESS], 0 0 8px #03edf9[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace blue */
//updatedThemeStyles = updatedThemeStyles.replace(/color: #36f9f6;/g, "color: #fdfdfd; text-shadow: 0 0 2px #001716, 0 0 3px #03edf9[NEON_BRIGHTNESS], 0 0 5px #03edf9[NEON_BRIGHTNESS], 0 0 8px #03edf9[NEON_BRIGHTNESS]; backface-visibility: hidden;");
updatedThemeStyles = updatedThemeStyles.replace(/color: #36f9f6;/g, "color: #fdfdfd; text-shadow: 0 0 2px #000, 0 0 3px #03edf9[NEON_BRIGHTNESS], 0 0 5px #03edf9[NEON_BRIGHTNESS], 0 0 8px #03edf9[NEON_BRIGHTNESS]; backface-visibility: hidden;");

/* replace neon red */
updatedThemeStyles = updatedThemeStyles.replace(/color: #9945ff;/g, "color: #aa67ff; text-shadow: 0 0 2px #000, 0 0 10px #881ffc[NEON_BRIGHTNESS], 0 0 5px #881ffc[NEON_BRIGHTNESS], 0 0 25px #881ffc[NEON_BRIGHTNESS]; backface-visibility: hidden;");
}

/* append the remaining styles */
updatedThemeStyles = `${updatedThemeStyles}[CHROME_STYLES]`;

const cacheBust = (Math.random() + 1).toString(36).substring(7);

const newStyleTag = document.createElement('style');
newStyleTag.setAttribute("id", "solanabeach-22-theme-styles");
newStyleTag.setAttribute("id", "solanabeach-22-theme-styles"+cacheBust);
newStyleTag.innerText = updatedThemeStyles.replace(/(\r\n|\n|\r)/gm, '');
document.body.appendChild(newStyleTag);

Expand All @@ -60,8 +49,8 @@
const watchForBootstrap = function(mutationsList, observer) {
for(let mutation of mutationsList) {
if (mutation.type === 'attributes') {
// only init if we're using a SolanaBeach 22 subtheme
const isUsingSolanaBeach = document.querySelector('[class*="ZelimirFedoran-solanabeach-vscode-themes"]');
// only init if we're using a Synthwave 84 subtheme
const isUsingSolanaBeach = document.querySelector('[class*="zfedoran-solanabeach-vscode-themes"]');
// does the style div exist yet?
const tokensLoaded = document.querySelector('.vscode-tokens-styles');
// does it have content ?
Expand All @@ -80,7 +69,7 @@
}
}
if (mutation.type === 'childList') {
const isUsingSolanaBeach = document.querySelector('[class*="ZelimirFedoran-solanabeach-vscode-themes"]');
const isUsingSolanaBeach = document.querySelector('[class*="zfedoran-solanabeach-vscode-themes"]');
const tokensLoaded = document.querySelector('.vscode-tokens-styles');
const tokenStyles = document.querySelector('.vscode-tokens-styles').innerText
&& document.querySelector('.vscode-tokens-styles').innerText !== '';
Expand Down
Binary file added theme-neon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cafadb9

Please sign in to comment.