Comments (4)
I did this for my Themes here. I just used PowerShell to take cropped screenshots for the Theme screenshot and Theme icon. I also auto generated all of my package.json values. It would be great if you could do this programmatically just based on the input colors in some way.
My way still required a manual action per theme (switching to target theme), but I was also intentionally doing it manually because I was also looking for bugs caused by the conversion. After I changed theme, I just ran a command and it would take screenshots and update json etc. Then I just inspected everything looking for issues.
from vscode-theme-generator.
I was just thinking having color squares to indicate the colors but it would be really cool if a screenshot could be done too. I found out today that themes are finally being added/explored in Feb microsoft/vscode#20021 to settings, so there would no longer be a manual action necessary
from vscode-theme-generator.
Color Squares isn't a bad idea. Screenshots don't always display all colors, so having a combination of color squares and a screenshot might be a nice combo.
I quickly threw this together after I put my daughter to bed. In the themes I was working with, I didn't have an easy list of the color codes. I just wrote this in PowerShell, so I'd assume there has to be something similar in js. The better way to do it would likely be to take the colors as input instead, so $Green instead $CommentColor etc. The one issue with this, is I am just creating a bitmap and replacing the text colors, so it isn't a real screenshot of the theme in Code.
I am also not 100% sure how the colors translate to PowerShell, so the colors I used might not be totally correct, but I was just wanting to kind of make an example.
function New-ThemeImage
{
[CmdletBinding()]
param
(
$Filename,
$BackgroundColor,
$ForegroundColor,
$StringColor,
$CommentColor,
$KeywordColor,
$FunctionColor,
$FunctionCallColor,
$ClassColor
)
Add-Type -AssemblyName System.Drawing
$Bitmap = new-object System.Drawing.Bitmap 300,230
$font = new-object System.Drawing.Font Consolas,14
$Gfx = [System.Drawing.Graphics]::FromImage($Bitmap)
$Gfx.FillRectangle($BackgroundColor,0,0,$Bitmap.Width,$Bitmap.Height)
$Gfx.DrawString('function',$font,$KeywordColor,10,10)
$Gfx.DrawString(' Test-Function',$font,$ClassColor,90,10)
$Gfx.DrawString('{',$font,$ForegroundColor,10,35)
$Gfx.DrawString('# Test Comment',$font,$CommentColor,40,60)
$Gfx.DrawString('$',$font,$KeywordColor,40,85)
$Gfx.DrawString('var',$font,$FunctionColor,50,85)
$Gfx.DrawString('= ',$font,$ForegroundColor,90,85)
$Gfx.DrawString('"Hello World"',$font,$StringColor,110,85)
$Gfx.DrawString('$',$font,$KeywordColor,40,110)
$Gfx.DrawString('var',$font,$FunctionColor,50,110)
$Gfx.DrawString('.Replace',$font,$FunctionCallColor,80,110)
$Gfx.DrawString('(',$font,$KeywordColor,160,110)
$Gfx.DrawString('"Hello "',$font,$StringColor,170,110)
$Gfx.DrawString(',',$font,$KeywordColor,250,110)
$Gfx.DrawString('""',$font,$StringColor,260,110)
$Gfx.DrawString(')',$font,$KeywordColor,280,110)
$Gfx.DrawString('Return ',$font,$KeywordColor,40,160)
$Gfx.DrawString('$',$font,$KeywordColor,110,160)
$Gfx.DrawString('var',$font,$FunctionColor,120,160)
$Gfx.DrawString('}',$font,$ForegroundColor,10,185)
$Gfx.Dispose()
$Bitmap.Save($Filename)
}
function Convert-ColorCode
{
param($Color)
[System.Drawing.SolidBrush]::new([System.Drawing.ColorTranslator]::FromHtml($Color))
}
$Theme = @{
BackgroundColor = Convert-ColorCode '#151B24'
ForegroundColor = Convert-ColorCode '#efefef'
StringColor = Convert-ColorCode '#DA6771'
CommentColor = Convert-ColorCode '#4A5160'
KeywordColor = Convert-ColorCode '#399EF4'
FunctionColor = Convert-ColorCode '#21C5C7'
FunctionCallColor = Convert-ColorCode '#fff099'
ClassColor = Convert-ColorCode '#21C5C7'
}
New-ThemeImage @Theme -Filename "C:\Test.png"
When running that it produces a png that looks like this.
The idea would be that you could take the inputs from the generator and plug them into the functions to dynamically create a png with the proper colors.
from vscode-theme-generator.
While definitely cool, the problem with that is it doesn't look much like VS Code (and it's too much work to perfect it imo). I think you've hooked me on the screenshot of VS Code idea in https://github.com/gerane/VSCodeThemes/blob/master/CreateNewThemes/UpdateThemes.ps1
Combine that with some --user-data-dir
magic and we can get things like line numbers, whitespace, guides, etc. displaying in an automated manner too.
from vscode-theme-generator.
Related Issues (20)
- Support themes that want to use lineHighlightBackground
- Error message when I hit F5 HOT 1
- very unusual request HOT 1
- Is it intentionally that functions and methods have different colors? HOT 1
- HTML doesn't support special characters HOT 1
- Interpolated characters not highlighted HOT 1
- Not fixed bug with leaking string colors HOT 8
- Markdown doesn't support inline code blocks HOT 1
- No highlight for escaped and special characters HOT 2
- Support editorGroup.dropBackground
- Support editorGroup.focusedEmptyBorder
- jsonc and json property key colors differ
- Support titleBar.inactiveBackground
- Selections have become somewhat confusing HOT 1
- When running "npm install" in vscode to set this up, it returns the error "node_modules/@types/node/index.d.ts:20:1 - error TS1084: Invalid 'reference' directive syntax." HOT 6
- Adopt bracket colorization theme keys
- Possible to add token color overrides?
- Focus background should be transparent
- Adopt new editor diff theme keys
- es una prueba
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-theme-generator.