Page 5 of 5
Re: Object Theme Library (for Dark or Light Theme)
Posted: Wed May 29, 2024 1:51 pm
by ChrisR
Hi blueb,
There was indeed a mix-up between ObjectTheme and ObjectButton on the non-module version on this line. I usually use the Module version.
I updated on GitHub otherwise, you can just change SetObjectButtonColor to SetButtonThemeColor on line 3476
Thank you for reporting
Re: Object Theme Library (for Dark or Light Theme)
Posted: Fri Jun 07, 2024 2:33 am
by coco2
Hi ChrisR, are you able to make an option for normal buttons? I don't think buttons with circle gradients fits the overall theme, it stands out a bit. Or could you direct me to the code where I can do it myself?
Re: Object Theme Library (for Dark or Light Theme)
Posted: Sat Jun 08, 2024 1:01 pm
by ChrisR
Ha, tastes and colors...
I understand that it's not for everyone but it's my choice here and it suits me
You can probably try changing the way the button images are painted in MakeButtonTheme() procedure to suit your needs.
This procedure is quite simple, with theme colors available under *ObjectThemeBtnInfo\xxxxx
Code: Select all
If StartDrawing(ImageOutput(*ThisImage))
Box(0, 0, cX, cY, \lButtonCornerColor)
_RoundBox(0, 0, cX, cY, \lRoundX, \lRoundY, ButtonBackColor | $80000000)
DrawingMode(#PB_2DDrawing_Gradient | #PB_2DDrawing_AlphaBlend)
; Draw an ellipse a little wider than the button and slightly offset upwards, to have a gradient with the background color in the 4 corners and more important at the bottom
; You can change the design here and do it differently to suit your taste for the 5 button images
EllipticalGradient(cX / 2, cY * 2 / 5, cX * 3 / 5, cY * 4 / 5)
GradientColor(0.0, ButtonBackColor | $BE000000)
Select I
Case 0, 4 ; imgRegular, imgDisabled
GradientColor(0.15, ButtonBackColor | $BE000000)
Case 1, 3 ; imgHilite, imgHiPressed
GradientColor(0.3, ButtonBackColor | $BE000000)
Case 2 ; imgPressed
GradientColor(0.45, ButtonBackColor | $BE000000)
EndSelect
GradientColor(1.0, \lButtonOuterColor | $BE000000)
_RoundBox(0, 0, cX, cY, \lRoundX, \lRoundY)
; Border drawn with button color and an inner 1 px border with background color (full inside or top left or bottom right)
DrawingMode(#PB_2DDrawing_Outlined)
Select I
Case 0, 4 ; imgRegular, imgDisabled
_RoundBox(0, 0, cX, cY, \lRoundX, \lRoundY, \lBorderColor)
_RoundBox(1, 1, cX-2, cY-2, \lRoundX, \lRoundY, \lButtonOuterColor)
Case 1, 2 ; imgHilite, imgPressed
_RoundBox(0, 0, cX, cY, \lRoundX, \lRoundY, \lHighLightBorder)
_RoundBox(1, 1, cX-2, cY-2, \lRoundX, \lRoundY, \lButtonOuterColor)
Case 3 ; imgHiPressed
_RoundBox(0, 0, cX, cY, \lRoundX, \lRoundY, \lHighLightBorder)
_RoundBox(1, 1, cX-2, cY-2, \lRoundX, \lRoundY, \lBorderColor)
_RoundBox(2, 2, cX-4, cY-4, \lRoundX, \lRoundY, \lButtonOuterColor)
EndSelect
StopDrawing()
EndIf
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 12:51 pm
by Distorted Pixel
Hi, is there a way to change the window title bar to the same color as the window background?
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 4:10 pm
by ChrisR
Yes, but for Windows 11 only with nicoh's code
[Win11] Custom window title color
I've added DwmSetWindowAttribute Caption, Border and Text Color for Windows 11.
And also Use_Immersive_Dark_Mode for Windows 10 and up.
I updated on GitHub but i haven't tested it, i'm on windows 10 and i don't have a windows 11 VM yet.
If you have Windows 11, let me know how it is.
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 4:44 pm
by Distorted Pixel
ChrisR wrote: Tue Jun 11, 2024 4:10 pm
Yes, but for Windows 11 only with nicoh's code
[Win11] Custom window title color
I've added DwmSetWindowAttribute Caption, Border and Text Color for Windows 11.
And also Use_Immersive_Dark_Mode for Windows 10 and up.
I updated on GitHub but i haven't tested it, i'm on windows 10 and i don't have a windows 11 VM yet.
If you have Windows 11, let me know how it is.
I'm on Windows 10 64 bit anyway. I won't have Windows 11 probably until next year some time.
So I assume title bar stuff works on Windows 10?
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 5:06 pm
by ChrisR
No, it's only for windows 11
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 5:29 pm
by AZJIO
Distorted Pixel wrote: Tue Jun 11, 2024 4:44 pm
So I assume title bar stuff works on Windows 10?
I changed the
color of the title bar in Win10x64
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 5:37 pm
by Distorted Pixel
ChrisR wrote: Tue Jun 11, 2024 5:06 pm
No, it's only for windows 11
I'll play around with it tonight and see if I can get it to work on windows 10
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 5:38 pm
by Distorted Pixel
AZJIO wrote: Tue Jun 11, 2024 5:29 pm
Distorted Pixel wrote: Tue Jun 11, 2024 4:44 pm
So I assume title bar stuff works on Windows 10?
I changed the
color of the title bar in Win10x64
That looks like registry editing. I don't want it changed permanently. Especially if my software edits someone else's without their knowledge.
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 5:41 pm
by AZJIO
I'm not sure if my answer is appropriate for this topic. You probably only want to change your own window, but I am making the change for all windows.
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 5:55 pm
by Caronte3D
Distorted Pixel wrote: Tue Jun 11, 2024 12:51 pm
Hi, is there a way to change the window title bar to the same color as the window background?
Use a window without title bar and draw it yourself directly over the body of the window.
Re: Object Theme Library (for Dark or Light Theme)
Posted: Tue Jun 11, 2024 7:03 pm
by AZJIO
Code: Select all
EnableExplicit
; #HTCLOSE = 20
#Window = 0
#TitleHeight = 30
#BtnWidth = 46
Enumeration
#Title
#Close
#Minimize
#Maximize
EndEnumeration
; Declare MyWindowCallback(WindowId, Message, wParam, lParam)
Procedure MyWindowCallback(WindowId, Message, wParam, lParam)
Protected Result = #PB_ProcessPureBasicEvents
Protected.l nNotifyCode, nID, x, y
Select Message
Case #WM_NCHITTEST
x = lParam & $FFFF ; LoWord
y = lParam >> 16 ; HiWord
x - WindowX(#Window)
y - WindowY(#Window)
If x < 700 And y < 30
ProcedureReturn #HTCAPTION
; ElseIf x > 760 And x < 790 And y < 30
; ProcedureReturn #HTCLOSE
EndIf
Case #WM_COMMAND
nID = wParam & $FFFF ; LoWord
nNotifyCode = wParam >> 16 ; HiWord
Select lParam
Case GadgetID(#Close)
Select nNotifyCode
Case #BN_CLICKED
End
EndSelect
Case GadgetID(#Minimize)
Select nNotifyCode
Case #BN_CLICKED
SetWindowState(#Window, #PB_Window_Minimize)
EndSelect
Case GadgetID(#Maximize)
Select nNotifyCode
Case #BN_CLICKED
If GetWindowState(#Window) = #PB_Window_Maximize
SetWindowState(#Window, #PB_Window_Normal)
Else
SetWindowState(#Window, #PB_Window_Maximize)
EndIf
EndSelect
EndSelect
EndSelect
ProcedureReturn Result
EndProcedure
Procedure SizeHandler()
Protected w, h
w = WindowWidth(#Window)
ResizeGadget(#Title, #PB_Ignore, #PB_Ignore, w - #BtnWidth * 3, #PB_Ignore)
ResizeGadget(#Close, w - #BtnWidth, #PB_Ignore, #PB_Ignore, #PB_Ignore)
ResizeGadget(#Minimize, w - #BtnWidth * 3, #PB_Ignore, #PB_Ignore, #PB_Ignore)
ResizeGadget(#Maximize, w - #BtnWidth * 2, #PB_Ignore, #PB_Ignore, #PB_Ignore)
EndProcedure
If OpenWindow(#Window, 0, 0, 790, 200, "", #PB_Window_BorderLess | #PB_Window_ScreenCentered) ; | #WS_SIZEBOX)
TextGadget(#Title, 0, 0, 700, #TitleHeight, "Window title")
SetGadgetColor(#Title, #PB_Gadget_BackColor, $7E7969)
SetGadgetColor(#Title, #PB_Gadget_FrontColor, $FFFFFF)
TextGadget(#Close, 790 - #BtnWidth, 0, #BtnWidth, #TitleHeight, "X", #SS_NOTIFY | #PB_Text_Center) ; | #PB_Text_Border)
SetGadgetColor(#Close, #PB_Gadget_BackColor, $3030FF)
SetGadgetColor(#Close, #PB_Gadget_FrontColor, $FFFFFF)
TextGadget(#Minimize, 790 - #BtnWidth * 3, 0, #BtnWidth, #TitleHeight, "_", #SS_NOTIFY | #PB_Text_Center)
SetGadgetColor(#Minimize, #PB_Gadget_BackColor, $FF3030)
SetGadgetColor(#Minimize, #PB_Gadget_FrontColor, $FFFFFF)
TextGadget(#Maximize, 790 - #BtnWidth * 2, 0, #BtnWidth, #TitleHeight, Chr($25A1), #SS_NOTIFY | #PB_Text_Center) ; $20E3
SetGadgetColor(#Maximize, #PB_Gadget_BackColor, $FF3030)
SetGadgetColor(#Maximize, #PB_Gadget_FrontColor, $FFFFFF)
SetWindowColor(#Window, $bddada)
SetWindowCallback(@MyWindowCallback())
BindEvent(#PB_Event_SizeWindow, @SizeHandler())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf