-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explore generating an image and/or piece of Markdown that describes the theme #20
Comments
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. |
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 |
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. |
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 |
It's too much effort to do a detailed write up if you publish multiple themes, maybe the generator could generate one, including images to demonstrate the colors?
The text was updated successfully, but these errors were encountered: