It is currently March 29th, 2024, 1:46 pm

relative text size for time and date

Get help with creating, editing & fixing problems with skins
User avatar
totallybree
Posts: 12
Joined: November 18th, 2020, 6:01 pm

relative text size for time and date

Post by totallybree »

Hey there! I've been working on a minimalist clock and with help from you all it works! Thanks to everyone who helped out!

Now I'd like to have a version that includes the date. I have it looking pretty good, but I'm not satisfied yet lol. I'd like to see if there's a simple way to make the typestyle of the date smaller than the time. I'd like it to be relative, so if I change the size of the clock text, the date size will adjust automatically to be 2p smaller than the time. If I have to adjust them separately that would be okay too, I just don't know how to do that either.

Also, I have it set up right now with #crlf# between the time and date to put them on separate lines. I did that and got them centered, and they look ok but the lines are too close together. how can I put a little bit of space between them?

ini text behind spoiler.

Thanks for any help!

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]
MyFontColor=160,203,0   
MyFontFace=Digito

[MyTextStyle]
AntiAlias=1
FontColor=#MyFontColor#
FontFace=#MyFontFace#

[MeasureTime]
Measure=Time
Format=  %#I:%M %p#CRLF#%D
Substitute="AM":"am","PM":"pm"

[MeterTime]
Meter=String
MeasureName=MeasureTime
MeterStyle=MyTextStyle

FontSize=11
Padding=4,6,4,6
SolidColor=0,0,0,116
StringAlign=Center
X=100
Last edited by eclectic-tech on November 20th, 2020, 5:32 pm, edited 1 time in total.
Reason: Please use code tags. It is the </> symbol.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: relative text size for time and date

Post by FreeRaider »

A first solution:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Variables]
MyFontColor=160,203,0
MyFontFace=Digito
MyFontSize=11

[MyTextStyle]
AntiAlias=1
FontColor=#MyFontColor#
FontFace=#MyFontFace#
DynamicVariables=1

[MeasureTime]
Measure=Time
Format= %#I:%M %p#CRLF#%D
Substitute="AM":"am","PM":"pm"

[MeterTime]
Meter=String
MeasureName=MeasureTime
MeterStyle=MyTextStyle

FontSize=#MyFontSize#
Padding=4,6,4,6
SolidColor=0,0,0,116
StringAlign=Center
X=100
InlineSetting=Size | (#MyFontSize#-2)
InlinePattern=(.*\/.*\/.*)
For Inline Option, have a look at https://docs.rainmeter.net/manual/meters/string/inline/
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: relative text size for time and date

Post by balala »

FreeRaider wrote: November 20th, 2020, 5:43 pm A first solution:
Not a huge mistake, but just note that slash (/) is not a reserved character in regular expressions, so you don't have to escape it. So you can replace the InlinePattern with the following, simpler form: InlinePattern=(.*/.*/.*).
The reserved characters are the following ones: ., ^, $, *, +, ?, (, ), [, {, \ and |. An interesting detail here is that even if for instance [ and { are reserved characters, their coresponding pairs ] and } are not.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: relative text size for time and date

Post by FreeRaider »

balala wrote: November 20th, 2020, 6:22 pm Not a huge mistake, but just note that slash (/) is not a reserved character in regular expressions, so you don't have to escape it. So you can replace the InlinePattern with the following, simpler form: InlinePattern=(.*/.*/.*).
The reserved characters are the following ones: ., ^, $, *, +, ?, (, ), [, {, \ and |. An interesting detail here is that even if for instance [ and { are reserved characters, their coresponding pairs ] and } are not.
Thanks for the explanation :thumbup:
User avatar
totallybree
Posts: 12
Joined: November 18th, 2020, 6:01 pm

Re: relative text size for time and date

Post by totallybree »

Hey thanks to you both! That worked perfectly. Any suggestions about moving the two lines further apart?
I put in another #crlf# and got a full line between them but that's too much space of course.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: relative text size for time and date

Post by balala »

totallybree wrote: November 20th, 2020, 7:37 pm Any suggestions about moving the two lines further apart?
I put in another #crlf# and got a full line between them but that's too much space of course.
You might want adjust the distance between the two lines for instance this way:

Code: Select all

[MeasureTime]
Measure=Time
Format=  %#I:%M %p#CRLF##CRLF#%D
Substitute="AM":"am","PM":"pm"

[MeterTime]
Meter=String
MeasureName=MeasureTime
MeterStyle=MyTextStyle
FontSize=#MyFontSize#
Padding=4,6,4,6
SolidColor=0,0,0,116
StringAlign=Center
X=100
InlineSetting=Size | (#MyFontSize#-2)
InlinePattern=(.*/.*/.*)
InlineSetting2=Size | (#MyFontSize#/4)
InlinePattern2=(#CRLF#)
Note the newly added InlineSetting2 and InlinePattern2 options to the [MeterTime] meter. Adjust the distance by the parameter 4 of InlineSetting2 option.
User avatar
totallybree
Posts: 12
Joined: November 18th, 2020, 6:01 pm

Re: relative text size for time and date

Post by totallybree »

Perfection.

I know the goal in here is to teach people to do things for themselves, but I'm not a coder and all I wanted was a clock, so I really appreciate you taking the time to help me. Thanks!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: relative text size for time and date

Post by balala »

totallybree wrote: November 20th, 2020, 8:21 pm I know the goal in here is to teach people to do things for themselves, but I'm not a coder and all I wanted was a clock, so I really appreciate you taking the time to help me.
Always, when I can. Glad you succeeded in writing the skin. Congrats...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: relative text size for time and date

Post by SilverAzide »

totallybree wrote: November 20th, 2020, 8:21 pm Perfection.

I know the goal in here is to teach people to do things for themselves, but I'm not a coder and all I wanted was a clock, so I really appreciate you taking the time to help me. Thanks!
If you want a nice simple clock that you don't need to program yourself but looks almost like what you wanted, you can try the one in ModernGadgets. You can turn everything off so it is just a time and date, and change the colors to whatever you want.
Gadgets Wiki GitHub More Gadgets...
User avatar
totallybree
Posts: 12
Joined: November 18th, 2020, 6:01 pm

Re: relative text size for time and date

Post by totallybree »

balala wrote: November 20th, 2020, 8:38 pm Always, when I can. Glad you succeeded in writing the skin. Congrats...
I would definitely not say I wrote it, it was a team effort! =)