DICE PACKS BUNDLE
Page 1 of 2 12 Last
  1. #1

    [SOLVED] How to change calendar days/months font color?

    Please see post: #14 for the solution .

    FGU latest public release
    5E Ruleset
    Gregorian Calendar

    Hey there,
    while working on a theme, I stumbled across a problem that I wasn't able to solve for 2 weeks now and searching the forum didn't provide any results related to this:

    I absolutely can't figure out how to change the font color (to white or something else) for the days and months in the calendar.
    Font_Issue.png
    Calendar_Colors.png

    I figured that the xml entries below should do the trick, but this didn't work. I found that at least some colors can be influenced by using the utility_calendar.xml,
    but I'd like to avoid having too many xml files included in the theme.

    Does anyone have a clue what I'm missing?
    The fonts are correctly placed within the fonts folder and all paths are correct.

    Here the fonts.xml entries I thought should work, but don't:

    <!-- Calendar -->
    <font name="calendarday">
    <fgffile name="graphics/fonts/regular-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Regular.ttf" name="Roboto" size="16" />
    <color value="#DDDDDD" />
    </font>
    <font name="calendarday-b">
    <fgffile name="graphics/fonts/regular-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Regular.ttf" name="Roboto" size="16" />
    <color value="#DDDDDD" />
    </font>
    <font name="calendarday-bi">
    <fgffile name="graphics/fonts/regular-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Regular.ttf" name="Roboto" size="16" />
    <color value="#DDDDDD" />
    </font>
    <font name="calendarbold">
    <fgffile name="graphics/fonts/bold-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Bold.ttf" name="Roboto-Bold" size="16" />
    <color value="#DDDDDD" />
    </font>
    <font name="calendarselecttitle">
    <fgffile name="graphics/fonts/bold-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Bold.ttf" name="Roboto-Bold" size="16" />
    <color value="#DDDDDD" />
    </font>
    <font name="calendarselectbody">
    <fgffile name="graphics/fonts/regular-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Regular.ttf" name="Roboto" size="16" />
    <color value="#DDDDDD" />
    </font>
    <font name="calendarmessage">
    <fgffile name="graphics/fonts/italic-10.fgf" />
    <ttf file="graphics/fonts/Roboto-Italic.ttf" name="Roboto-Italic" size="16" />
    <color value="#DDDDDD" />
    </font>

    Thanks in advance!

    SirMotte
    Last edited by SirMotte; May 30th, 2020 at 20:39.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    check corerpg
    \utility\utility_calendar.xml

    Code:
    			<stringcontrol name="viewdate">
    				<anchored to="dateframe" height="20">
    					<right anchor="center" offset="-80" />
    					<top offset="25" />
    				</anchored>
    				<color>5A1E33</color>
    				<font>calendarbold</font>
    				<nodrag />
    				<nodragselect />
    				<readonly />
    			</stringcontrol>
    			<label_fieldtop>
    				<anchored to="viewdate" />
    				<static textres="calendar_label_date" />
    			</label_fieldtop>
    			<basicnumber name="currentyear" source="current.year">
    				<anchored to="dateframe" width="40" height="20">
    					<left anchor="center" offset="-70" />
    					<top offset="25" />
    				</anchored>
    				<color>5A1E33</color>
    				<hideonvalue>0</hideonvalue>
    				<delaykeyupdate />
    				<script>
    					function onValueChanged()
    						window.onYearChanged();
    					end
    				</script>
    			</basicnumber>
    You can see several colours being defined there - after the font has already been defined.

  3. #3
    Quote Originally Posted by damned View Post
    check corerpg
    \utility\utility_calendar.xml

    Code:
    			<stringcontrol name="viewdate">
    				<anchored to="dateframe" height="20">
    					<right anchor="center" offset="-80" />
    					<top offset="25" />
    				</anchored>
    				<color>5A1E33</color>
    				<font>calendarbold</font>
    				<nodrag />
    				<nodragselect />
    				<readonly />
    			</stringcontrol>
    			<label_fieldtop>
    				<anchored to="viewdate" />
    				<static textres="calendar_label_date" />
    			</label_fieldtop>
    			<basicnumber name="currentyear" source="current.year">
    				<anchored to="dateframe" width="40" height="20">
    					<left anchor="center" offset="-70" />
    					<top offset="25" />
    				</anchored>
    				<color>5A1E33</color>
    				<hideonvalue>0</hideonvalue>
    				<delaykeyupdate />
    				<script>
    					function onValueChanged()
    						window.onYearChanged();
    					end
    				</script>
    			</basicnumber>
    You can see several colours being defined there - after the font has already been defined.
    Hey damned thank you for the reply!

    The core utility_calendar.xml is what I currently use to define the colors at the calendar top (see image above). Unfortunately the entries there do not seem to affect the day number columns in any way.
    Also shouldn't the graphics_fonts.xml affect those aswell, as they change the parameters of eg. "calendarbold"?

    Thanks
    SirMotte

    Edit: Okay, I just deleted the color entries in the utility_calendar.xml to see if the #DDDDDD color definition in my graphics_fonts.xml would work at all. And it does. That means I am missing the proper "font name =" definition for the calendar days font?
    Font_Issue_no_utility_calendar_definition.png
    Last edited by SirMotte; May 25th, 2020 at 15:01.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    No.
    The fonts are defined first.
    The templates are defined next.
    The file above is running last and it has a color code in it.
    You will need to merge your changes into the calendar file Im pretty sure.

  5. #5
    Quote Originally Posted by damned View Post
    No.
    The fonts are defined first.
    The templates are defined next.
    The file above is running last and it has a color code in it.
    You will need to merge your changes into the calendar file Im pretty sure.
    You are right in regard to loadorder. Please see attached picture on what I found out about what affects the colors in the calendar.
    Calendar_Colors.png

    As you can see I can influence some entries with the graphics_fonts.xml if I delete the corresponding color definition inside the utility_calendar.xml. Ultimately I prefer to use the fonts.xml, as I don't like to have things scattered around when changing colors. Other areas are defined directly inside the .lua files.
    Yet I still wasn't able to find out how to change the day colums to another color as there doesn't seem to be an entry anywhere, at least I wasn't able to find it.

    Thank you for your patience!

    Cheers
    SirMotte
    Last edited by SirMotte; May 27th, 2020 at 14:28.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    So... it would be nice if everything used a set entry in graphics_fonts.xml and nothing else.
    For whatever reason some definitions are re-used but the color code is modified in the xml at the point where the font is used.
    In those cases you will need to use merge="join" code to overwrite those settings.

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Fonts all take up resources in the FG client. The more font definitions you have, the more resources you're using. This may not have a massive effect overall, but it is still better to define a resource like this once and then, if you don't want to use the default colour from the <font> resource definition, change the colour when it's used within a control.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  8. #8
    Thanks for both your answers. Now this isn't really about where to define what, I simply cant figure out where to define the calendar day columns font at all. Please see the picture below.
    issue.png

    Please keep in mind, that I can't even be considered a novice in terms of any kind of programming language, so this might be a little over my head already?
    Last edited by SirMotte; May 27th, 2020 at 14:49.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  9. #9
    Quote Originally Posted by SirMotte View Post
    Thanks for both your answers. Now this isn't really about where to define what, I simply cant figure out where to define the calendar day columns font at all. Please see the picture below.
    issue.png

    Please keep in mind, that I can't even be considered a novice in terms of any kind of programming language, so this might be a little over my head already?
    I think the script you are looking for is in utility\scripts\calendar_day.lua in the setState() function.

    Code:
    function setState(bCurrDay, bSelDay, bHoliday, nodeEvent)
    	if bCurrDay then
    		setBackColor("000000");
    		label_day.setColor("FFFFFF");
    	else
    		setBackColor();
    		if bHoliday then
    			label_day.setColor("333399");
    		else
    			label_day.setColor("000000");
    		end
    	end
    	if bSelDay then
    		setFrame("calendarhighlight");
    	else
    		setFrame(nil);
    	end
    	if bHoliday then
    		label_day.setFont("calendarday-bi");
    		label_day.setUnderline(true);
    	else
    		label_day.setFont("calendarday");
    		label_day.setUnderline(false);
    	end
    The script seems to go through each day and determine its formatting based on if its the current day, if there are events, if its a holiday, etc.
    For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e

  10. #10
    Quote Originally Posted by mattekure View Post
    I think the script you are looking for is in utility\scripts\calendar_day.lua in the setState() function.

    Code:
    			label_day.setColor("333399");
    		else
    			label_day.setColor("000000");
    		end
    I always thought that this only defined the current day only, but you're correct!

    else
    label_day.setColor("000000");

    sounds promising.

    I'll give it a try!
    Last edited by SirMotte; May 29th, 2020 at 23:18.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
STAR TREK 2d20

Log in

Log in