8
$\begingroup$

The two functions TimeObject and DateObject (both introduced in version 10) feature neat DisplayForms:

TimeObject[0]
DateObject[0]

Blockquote

Custom content can be output in the same form using the DisplayForm of the TemplateBoxes associated with the objects:

DisplayForm@TemplateBox[{"Foo"}, "TimeObject", Editable -> False]
DisplayForm@TemplateBox[{"Bar"}, "DateObject", Editable -> False]

Blockquote


Question:

Is there a way to acces the style options internally used for creating this output? I am interested in frame color, frame thickness, rounding radius, font, font color etc. Furthermore, is there a way to acces the cute little icons representing the clock and calendar (as an image or symbol)?

$\endgroup$

1 Answer 1

10
$\begingroup$

One can get these information using

CurrentValue[{StyleDefinitions, "TimeObject", "TemplateBoxOptionsDisplayFunction"}]

and

CurrentValue[{StyleDefinitions, "DateObject", "TemplateBoxOptionsDisplayFunction"}]

The icons are

FrontEndResource["FEExpressions", "TimeObjectIcon"] // ToExpression

and

FrontEndResource["FEExpressions", "DateObjectIcon"] // ToExpression

Users working with version 10.3.0 might consider the following solution for accessing the icons:

CurrentValue[{StyleDefinitions, "TimeObject", 
"TemplateBoxOptionsDisplayFunction"}][[1, 1, 1, 1, 1]] // ToExpression

CurrentValue[{StyleDefinitions, "DateObject", 
"TemplateBoxOptionsDisplayFunction"}][[1, 1, 1, 1, 1]] // ToExpression
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.