Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Commit

Permalink
feat: Add "Random Color Theme" menu to the Command Palette.
Browse files Browse the repository at this point in the history
  • Loading branch information
bayramarslan committed Jul 4, 2024
1 parent bf86c15 commit 16deadb
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ vsc-extension-quickstart.md
**/*.ts
**/.vscode-test.*
install.ps1
images/screenshot-1.png
images/statusbar-theme-display.png
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@

All notable changes to the "theme-status" extension will be documented in this file.

#### [v0.0.1](https://github.com/bayramarslan/vscode-theme-display/tree/0.0.1)
#### [0.0.1](https://github.com/bayramarslan/vscode-theme-display/tree/0.0.1)

> May 5, 2024
- Initial release


#### [v0.0.3](https://github.com/bayramarslan/vscode-theme-display/compare/0.0.1...0.0.3)
#### [0.0.3](https://github.com/bayramarslan/vscode-theme-display/compare/0.0.1...0.0.3)

> July 3, 2024
- Added "I'm Feeling Lucky" feature: Click on "I'm Feeling Lucky" in the status bar to randomly switch to a different theme.


#### [0.0.4](https://github.com/bayramarslan/vscode-theme-display/compare/0.0.3...0.0.4)

> July 5, 2024
- Added "Random Color Theme" menu to the Command Palette.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Your Name
Copyright (c) 2024 Bayram Arslan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

VSCode Theme Display and Selector is a Visual Studio Code extension that displays the name of the active theme in the status bar and opens a theme selection list when clicked. With this extension, you can easily see the name of the active theme and quickly switch between themes.

![screenshot](images/screenshot-1.png)
![screenshot](images/statusbar-theme-display.png)

## Features

- Displays the name of the current theme in the status bar.
- Opens a theme selection list when the theme name is clicked.
- I'm Feeling Lucky: Click on "I'm Feeling Lucky" in the status bar to randomly switch to a different theme.
- Set "Random Color Theme" from command palette.
Binary file removed images/screenshot-1.png
Binary file not shown.
Binary file added images/statusbar-theme-display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 25 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,45 @@
"description": "Displays the current theme name in the status bar",
"icon": "images/icon.png",
"publisher": "bayramarslan",
"version": "0.0.3",
"version": "0.0.4",
"engines": {
"vscode": "^1.89.0"
},
"categories": [
"Visualization"
"Other"
],
"keywords": [
"theme",
"statusbar",
"color",
"color-theme",
"color-scheme",
"random",
"random-theme",
"shortcut",
"statusbar",
"theme",
"theme-name",
"theme-display",
"config",
"shortcut"
"theme-selector",
"theme-statusbar"
],
"activationEvents": [
"onStartupFinished"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "extension.randomTheme",
"title": "Random Color Theme"
}
],
"keybindings": [
{
"command": "extension.randomTheme",
"key": "ctrl+k n"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
Expand Down
27 changes: 10 additions & 17 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,24 @@ export function activate(context: vscode.ExtensionContext) {
const tooltip = new vscode.MarkdownString(
`Click to change theme [I'm Feeling Lucky](command:extension.randomTheme)`
);

tooltip.isTrusted = true;

currentTheme = getCurrentTheme();
statusBarItem.text = `${statusBarIcon} ${currentTheme}`;
statusBarItem.tooltip = tooltip;
statusBarItem.command = "workbench.action.selectTheme";

const disposable = vscode.commands.registerCommand(
const randomThemeLink = vscode.commands.registerCommand(
"extension.randomTheme",
randomTheme
);

context.subscriptions.push(disposable, statusBarItem);
context.subscriptions.push(randomThemeLink, statusBarItem);

statusBarItem.show();

vscode.workspace.onDidChangeConfiguration(updateStatusBar);
}

function updateStatusBar() {
if (!statusBarItem) {
return;
}

currentTheme = getCurrentTheme();
updateStatusBarText();
vscode.workspace.onDidChangeConfiguration(updateStatusBarText);
}

function getCurrentTheme(): string {
Expand All @@ -59,11 +53,10 @@ function randomTheme() {

vscode.workspace
.getConfiguration()
.update("workbench.colorTheme", randomTheme, true)
.then(() => {
currentTheme = randomTheme;
updateStatusBarText();
});
.update("workbench.colorTheme", randomTheme, true);

currentTheme = randomTheme;
updateStatusBarText();
}

function getAllThemes(): string[] {
Expand Down

0 comments on commit 16deadb

Please sign in to comment.