4
$\begingroup$

I would like to know how to find the background color used in Placeholder[abc]. It is some kind of Yellowish-Pinkish, I think.

There is also a "Placeholder" style used by FrameBox, but I would like to know just what background color it uses.

We could of course sample a placeholder box with a graphics program, but I would like to find a better way, internal to MMA, if possible.

$\endgroup$
4
$\begingroup$

TL;DR:

RGBColor @ {1., 0.972488, 0.797681}

Unfortunately there is no general way to track where options are inherited from and from which style etc., but often taking a look at Core.nb or Default.nb with Ctrl+F helps.

core = FileNameJoin[{
   $InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets", 
   "Core.nb"
   }]

Cases[
 NotebookImport[core, _ -> "Cell"],
 Cell[StyleData["Placeholder", ___], ___]
 ]
{Cell[StyleData["Placeholder", 
  StyleDefinitions -> StyleData["Label"]], ShowSyntaxStyles -> False,
Placeholder -> True, ShowStringCharacters -> False, 
StyleMenuListing -> None, FontSize -> 9, FontWeight -> "Plain", 
FontSlant -> "Italic", 
FontColor -> RGBColor[
 0.49321736476691846`, 0.49321736476691846`, 0.49321736476691846`], 
Background -> RGBColor[1., 0.9724879835202563, 0.7976806286717022], 
FrameBoxOptions -> {BaselinePosition -> Baseline, FrameMargins -> 2,
   FrameStyle -> {Directive[GrayLevel[0.79185], 
     Dashing[{0, Small}]]}}, 
TagBoxOptions -> {Editable -> False, Selectable -> False, 
  StripWrapperBoxes -> False}], 
Cell[StyleData["Placeholder", "Presentation"], FontSize -> 18], 
Cell[StyleData["Placeholder", "Condensed"], FontSize -> 8], 
Cell[StyleData["Placeholder", "Printout"], FontSize -> 8]}
$\endgroup$
  • $\begingroup$ Thanks Kuba, I was looking forward to this kind of technique. $\endgroup$ – magma Mar 14 '16 at 12:04
  • $\begingroup$ @magma Unfortunately there is no general way to track from options are inherited and from which style etc. But mostly taking a look at Core.nb and Default.nb with Ctrl+F helps. $\endgroup$ – Kuba Mar 14 '16 at 12:06
  • 1
    $\begingroup$ @Kuba yes there is, see kglr's answer. :) $\endgroup$ – rcollyer Mar 14 '16 at 14:33
  • $\begingroup$ @rcollyer Yep, that I know, I probably should have use that. My point was rather, "you never know where the Background/otherOption you see originates from". So here we are checking Placeholder's Background but you never know if that is not overwriten by FormatType etc etc. $\endgroup$ – Kuba Mar 14 '16 at 15:15
  • $\begingroup$ Ah, good point. $\endgroup$ – rcollyer Mar 14 '16 at 15:24
4
$\begingroup$

Also:

CurrentValue[{StyleDefinitions, "Placeholder", Background}]
(* or CurrentValue[{StyleDefinitions, "Placeholder", "Background"}] *)

RGBColor[1., 0.972487983, 0.797680]

$\endgroup$
  • $\begingroup$ Great answer too, thank you $\endgroup$ – magma Mar 14 '16 at 15:53

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.