It is currently Thu Jul 18, 2019 2:42 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [IDE Tool] ChangeTheme color switcher
PostPosted: Mon May 06, 2019 2:46 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
ChangeTheme is a tool for "instantly" switching the color theme of the PureBasic IDE, faster than going through the Preferences window. You can link it to a menu item or keyboard shortcut.

Run:
ChangeTheme <no parameters or ""> = open a browse dialog, activate file if chosen
or
ChangeTheme <theme file> = activate the specified *.prefs file (as exported from IDE)
or
ChangeTheme <theme file or ""> -a = apply the theme to the active Scintilla without touching the prefs file or relaunching

What it does:
- loads the colors
- tries to close the IDE, or else prompts you to close it
- writes the colors to your IDE preferences file
- re-launches the IDE
- 2019-06-09: new --apply/-a option to apply the style without touching the prefs file

Please try it out and submit suggestions!

Source and Windows exe on GitHub

Written for quick switching of the Solarized light and dark color themes


Last edited by kenmo on Mon Jun 10, 2019 4:05 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Wed May 15, 2019 12:07 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5818
Location: Wales, UK
Sounds really nice kenmo.

I think there might be a psychological issue though - we spend so much time getting the look just right, people don't want to try your switcher in case something goes wrong?

What if it made a backup preferences file of the IDE first? That would give people more confidence to try it?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Wed May 15, 2019 1:14 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 2:15 pm
Posts: 805
Location: Cuernavaca, Mexico
Ideasvacuum,

I've lost some templates and pref settings due to file corruption in the past
(it's really time consuming to rebuild these from scratch)
so I make a backup copy often (usually after I've made some changes to a template, etc.)

Code:
If CopyDirectory("C:\Users\Bob H\AppData\Roaming\PureBasic", "F:\Latest Home\PureBasic\Bobs Template Backup Folder", "", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
     Debug "Great...You made a backup copy of your Prefs files as well as your Templates!"
Else
     Debug "████ Something went wrong! ████"
EndIf

_________________
- It was too lonely at the top.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Wed May 15, 2019 2:12 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 2:15 pm
Posts: 805
Location: Cuernavaca, Mexico
Thanks kenmo... great addition and it works like a charm.

Now I can experiment without fear of 'redoing' all colors. :D

I took one of your prefs files, modified it with my present settings and saved it as 'BluebStyle.prefs'
This one seems easier on my eyes.. but maybe I'm jaded.

Using your tool I can switch back and forth at will... nice.

Code:
; Blueb's Color Theme for PureBasic IDE
;
 
[Sections]
IncludeColors = 1
 
[Colors]
ASMKeywordColor = 255
ASMKeywordColor_Used = 1
BackgroundColor = 14150650
BackgroundColor_Used = 1
BasicKeywordColor = 8388608
BasicKeywordColor_Used = 1
CommentColor = 32768
CommentColor_Used = 1
ConstantColor = 128
ConstantColor_Used = 1
LabelColor = 8421504
LabelColor_Used = 1
NormalTextColor = 4210816
NormalTextColor_Used = 1
NumberColor = 8388608
NumberColor_Used = 1
OperatorColor = 8388608
OperatorColor_Used = 1
PointerColor = 12615808
PointerColor_Used = 1
PureKeywordColor = 16711680
PureKeywordColor_Used = 1
SeparatorColor = 8388608
SeparatorColor_Used = 1
StringColor = 33023
StringColor_Used = 1
StructureColor = 12615808
StructureColor_Used = 1
LineNumberColor = 7303023
LineNumberColor_Used = 1
LineNumberBackColor = 15263976
LineNumberBackColor_Used = 1
MarkerColor = 11184640
MarkerColor_Used = 1
CurrentLineColor = 16777215
CurrentLineColor_Used = 1
SelectionColor = 4237800
SelectionColor_Used = 1
SelectionFrontColor = 0
SelectionFrontColor_Used = 1
CursorColor = 0
CursorColor_Used = 1
Debugger_LineColor = 16771304
Debugger_LineColor_Used = 1
Debugger_LineSymbolColor = 16771304
Debugger_LineSymbolColor_Used = 1
Debugger_ErrorColor = 255
Debugger_ErrorColor_Used = 1
Debugger_ErrorSymbolColor = 255
Debugger_ErrorSymbolColor_Used = 1
Debugger_BreakPointColor = 11184640
Debugger_BreakPointColor_Used = 1
Debugger_BreakpoinSymbolColor = 11184640
Debugger_BreakpoinSymbolColor_Used = 1
DisabledBackColor = 16777215
DisabledBackColor_Used = 1
GoodBraceColor = 8388608
GoodBraceColor_Used = 1
BadBraceColor = 255
BadBraceColor_Used = 1
ProcedureBackColor = 1677721
ProcedureBackColor_Used = 1
CustomKeywordColor = 16744448
CustomKeywordColor_Used = 1
Debugger_WarningColor = 33023
Debugger_WarningColor_Used = 1
Debugger_WarningSymbolColor = 33023
Debugger_WarningSymbolColor_Used = 1
IndentColor = 32768
IndentColor_Used = 1
ModuleColor = 0
ModuleColor_Used = 1
SelectionRepeatColor = 11009968
SelectionRepeatColor_Used = 1
PlainBackground = 15138790
PlainBackground_Used = 1
ToolsPanel_FrontColor = 0
ToolsPanel_FrontColor_Used = 1
ToolsPanel_BackColor = 15786973
ToolsPanel_BackColor_Used = 1

_________________
- It was too lonely at the top.


Last edited by blueb on Mon May 20, 2019 4:17 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Wed May 15, 2019 4:33 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
IdeasVacuum wrote:
What if it made a backup preferences file of the IDE first? That would give people more confidence to try it?


It already does a simple version of that:
Code:
;- Back up existing Prefs file
If (#True)
  CopyFile(PrefsFile, PrefsFile + ".backup")
EndIf


But of course I'm open to smarter backup and other suggestions.
The code is small enough you can check out what it's doing:
https://github.com/kenmo-pb/tools/blob/ ... geTheme.pb


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Mon May 20, 2019 4:12 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
blueb wrote:
I took one of your prefs files, modified it with my present settings and saved it as 'BluebStyle.prefs'
This one seems easier on my eyes.. but maybe I'm jaded.


Looks good. The theme is quite different so you don't need my name and website in the file comments :)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Mon May 20, 2019 4:16 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 2:15 pm
Posts: 805
Location: Cuernavaca, Mexico
Whaaat?

You don't want to be associated with those God-awful colors? :P

Thanks again Ryan :)

_________________
- It was too lonely at the top.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Mon May 20, 2019 5:23 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
I was saving it to my folder of themes and was surprised it was "adapted by" me :lol:


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Thu Jun 06, 2019 4:47 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2430
Any idea to force PureBasic changing the color theme without restarting the IDE?


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Thu Jun 06, 2019 8:14 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
Michael Vogel wrote:
Any idea to force PureBasic changing the color theme without restarting the IDE?

Short answer: no, sorry. Gotta request that from the IDE developers.

Longer answer: I tried it and I'm able to immediately apply the theme colors. But there are (at least) 2 issues:
- IDE tools only receive the handle to the active Scintilla, so I can only apply colors to one open file
- I don't have handles to the compile log or the Tools sidebar, so they remain the old colors, which looks bad


Top
 Profile  
Reply with quote  
 Post subject: Re: [Tool] ChangeTheme color switcher
PostPosted: Sun Jun 09, 2019 1:10 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2430
kenmo wrote:
- IDE tools only receive the handle to the active Scintilla, so I can only apply colors to one open file

Could be fine, I think about switching between two themes only (light/dark) done by a simple Ctrl+F12 or so. If another code window hasn't been updated, it could be done by a simple shortcut.

kenmo wrote:
- I don't have handles to the compile log or the Tools sidebar, so they remain the old colors, which looks bad

Typically I don't use them, so they never are visible.
If used, they are created dynamically, so it would be cool to force PureBasic to accept a new color theme without retarting (otherwise it needs to permanently check the handles if the SysTabControl32 containing the Listbox is available to update the colors).

Could you show us your code doing the life color update?


Top
 Profile  
Reply with quote  
 Post subject: Re: [IDE Tool] ChangeTheme color switcher
PostPosted: Mon Jun 10, 2019 4:09 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
Michael, I took a first attempt at it. Windows-only.

Add the "-a" parameter to instantly style the Scintilla without touching the prefs file.

See the source and exe at the link in the original post.


Top
 Profile  
Reply with quote  
 Post subject: Re: [IDE Tool] ChangeTheme color switcher
PostPosted: Mon Jun 10, 2019 6:52 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 25, 2003 5:10 pm
Posts: 471
Location: Doubs - France
Nice tool kenmo!
Tks

_________________
A+
Denis


Top
 Profile  
Reply with quote  
 Post subject: Re: [IDE Tool] ChangeTheme color switcher
PostPosted: Mon Jun 10, 2019 9:06 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2430
Cool, I like it... I am switching with Ctrl+F11 between full and normal screen and with Ctrl+F12 between dark and light theme.

Would be cool to do the whole thing without an IDE "reboot". The -a option is great, but it seems that the background colors get lost as soon the editor starts a source code (F5).

Not sure, but maybe the keyword 'bolding' will be ignored as well...
...maybe Fred could implement a possibility to trigger a "soft reboot" like it is done when calling the preferences.


Top
 Profile  
Reply with quote  
 Post subject: Re: [IDE Tool] ChangeTheme color switcher
PostPosted: Tue Jun 11, 2019 3:41 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
Michael Vogel wrote:
The -a option is great, but it seems that the background colors get lost as soon the editor starts a source code (F5).

Ouch, that's another reason this method doesn't work well.
When you debug, the IDE changes the background color. It's not a different Scintilla style, it updates all the styles with the background in your prefs... which overwrites what my tool just set.

I think we should turn this into feature request(s) for the IDE :)

Michael Vogel wrote:
Not sure, but maybe the keyword 'bolding' will be ignored as well...

Can you clarify what you mean?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye