UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Theme Colors - Vba Methods To "get"/"put" Color Names, Access 2016    
 
   
Craig Carroll
post May 6 2020, 08:00 PM
Post#1



Posts: 7
Joined: 30-March 20



First-time poster and long-time lurker here. First I want to say thank you to all the great contributors to UA. Many (many!) times you have had the exact answer I was looking for!
Lately, since I had to "hunker in the bunker" I got bored, so I decided to try to understand Theme Colors and finally contribute to UA. The attachment is a 2016 database which contains my ideas; everything in it works for Forms & Reports (although it doesn't contain any Report).
The "guts" of the database is a Public Function named 'GetThemeColorName' and a Public Sub named 'PutThemeColorName':
'GetThemeColorName' returns the Theme Color Name for any Property within any Section or Control (or an empty string if it isn't a valid Theme Color; caller routines can handle errors). 'PutThemeColorName' uses a Theme Color Name to set all 3 Properties of a Theme Color into any Section or Control.
There is a read-only Sub which examines & displays all Properties.
There is a "demo" Form where the Fore & Back & Border colors for a Text Box can be manipulated to see 'PutThemeColorName' in action.
Finally, there is a Form which acts as a "shell" for Design View, from which any Theme Color can be saved into any Sections and/or Controls (with Undo).
I've been retired for a few years, and FWIW, it felt good to be "back in the saddle again" with Access, and I hope this is useful!
[attachment=94135:ThemeColors.zip]
Go to the top of the page
 
cheekybuddha
post May 7 2020, 04:27 AM
Post#2


UtterAccess Moderator
Posts: 13,015
Joined: 6-December 03
From: Telegraph Hill


welcome2UA.gif

Thank you for sharing!

With which version of Access did themes arrive?

--------------------


Regards,

David Marten
Go to the top of the page
 
isladogs
post May 7 2020, 05:09 AM
Post#3


UtterAccess VIP
Posts: 2,396
Joined: 4-June 18
From: Somerset, UK


@David
Themes were introduced with A2010.

@Craig
I've had a quick look and it looks like a clever bit of code though I haven't yet studied it in detail.
However, whilst I'm grateful that you uploaded it here, I'm not sure how it would be useful in practice.

I use themes to get a consistent look across all forms in an application - same colour scheme and fonts.
If I want to change the appearance an individual control or group of controls e.g. so they 'stand out', I wouldn't focus on the theme when doing so.

How do you envisage it would be used in applications?

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
Craig Carroll
post May 7 2020, 06:36 PM
Post#4



Posts: 7
Joined: 30-March 20



Hi isladogs,
The database was designed to show what's involved in making Forms & Reports "purely themified". The 'Modify Colors' form is an easier way to "fully themify" Forms/Reports (easier than going through the Property Sheet, IMHO), and it's not usually needed after that.
The 'GetThemeColorName' Function & 'PutThemeColorName' Sub are useful for "on-the-fly" color changes. For example, often I'll "get" the color name, use string manipulation to change the percentage of lighter/darker, then "put" the new color. Another example: I often disable/enable multiple controls in portions of a form, but other controls such as Boxes, Lines and Labels (if not "associated" with a control) in that portion of the form are unaffected, so I use "put" to make them "dim"/"normal" also, in synch. One more example (at the risk of boring everyone!): 1 form has an admittedly-weird Text Box that is Enabled & Locked (still "normal" colors), but I want the Back color to be "dimmed" (i.e., user can copy text from it but not edit it), so I "put" the Back color. Bottom line: any colors you want to change while a Form or Report is running. Thanks for the feedback!
Go to the top of the page
 
isladogs
post May 8 2020, 03:19 AM
Post#5


UtterAccess VIP
Posts: 2,396
Joined: 4-June 18
From: Somerset, UK


Thanks for the reply.
It would seem you use themes in a different way to me. Certainly I don't make as much use of themes as you do
Anyway, many thanks for your contribution

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
Craig Carroll
post May 8 2020, 04:53 PM
Post#6



Posts: 7
Joined: 30-March 20



Sometimes I've noticed that there is confusion about what "themes" means. The Design ribbon's Themes (and the Colors list) are different from Theme Colors. I can see that you know the difference, by the way.
My approach was simply to understand what "pure Theme Colors" entails. After looking at it, I've concluded that Microsoft had an excellent idea which was then very poorly implemented! The available colors are severely limited and most control types don't even implement Theme Colors (Command Button is about the only type that I use which does implement them). Also, why did they design it that you can enter a Theme Color directly into the Property Sheet (which is actually for NON-theme Properties, such as ForeColor), then somewhere internally your entry is "translated" into the 3 Properties for Theme Colors AND then they put an integer into the Property where you made your entry?! Good grief!! I learned a lot during this month-long process, but I'm very underwhelmed by the capabilities of "pure Theme Colors" to be useful. I'll continue to use all of the colors instead, just like you've described. Again, thanks for the conversation!
Go to the top of the page
 
Shananarocks2
post May 8 2020, 10:04 PM
Post#7



Posts: 24
Joined: 8-August 15



Thanks but probably superseded by the "Themes" concept now introduced in MS Access. If you really need to change colors you can either use the "conditional formatting" at the menu bar or during "OnCurrent" event use VBA to set the properties for individual textboxes or other controls including sections, headers and footers too.
This post has been edited by Shananarocks2: May 8 2020, 10:05 PM
Go to the top of the page
 
Craig Carroll
post May 9 2020, 04:19 AM
Post#8



Posts: 7
Joined: 30-March 20



@shananarocks2
Hi, and thanks for looking at my stuff.
I'm not sure what you mean by "Themes" concept; if you mean the 'Themes' that are in Design View's Design ribbon, those are totally from Theme Colors, which are certainly not superseded. In Design View, controls have at least 1 color Property, and Access usually (not always) defaults the value to be a Theme Color (for example, 'Text 1, Lighter 25%'. Also, click into the "color-picker" ('...' on the right-hand end of the Property); at the top of the color palette is a section labelled 'Theme Colors'.

As far as using VBA (not just in Sub 'Form_Current' but anywhere), I'm not sure what you mean because VBA is exactly what my Function 'GetThemeColorName' & Sub 'PutThemeColorName' are written in. The biggest difference when working with Theme Colors is that up to 3 (!) different Properties must be modified to change a color (and none of them are "surfaced" - Microsoft's terminology - in the Property Sheet!). My 2 routines do all the work: no hex-code, no RGB function, no integers, no hard-coded constants necessary - only the Theme Color Names are needed.

I've seen many, many UA (& other forums) threads about the mystery of working with Theme Colors, and I didn't know how 1 month ago, so I posted my demo database of what I learned.
All of the Public routines (in Module 'modThemeColorsPublicFunctionsAndSubs') are all that is needed if you want to manipulate Theme Colors; the Forms & Table etc. aren't much more than a "friendly" UI for demonstrating 'GetThemeColorName' & 'PutThemeColorName' (although I did work a long time on Module 'ModifyColors' & the Form it calls - I think it's quite useful...).
Thanks for the feedback, and I hope this answer wasn't "clear as mud"!
Go to the top of the page
 
Craig Carroll
post May 9 2020, 03:07 PM
Post#9



Posts: 7
Joined: 30-March 20



Wups in prior post: "totally from" --> "totally different from" smile.gif
Go to the top of the page
 
Craig Carroll
post May 25 2020, 08:37 PM
Post#10



Posts: 7
Joined: 30-March 20



There is an updated (much better!) version of the database in this new thread: New database version
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    8th July 2020 - 12:23 AM