Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I know FrontEnd`SelectionSetStyle is undocumented, but its name suggests it does what I need. What is its syntax?

I have already tried several variations of the following button on some selected code in an input cell.

Button["set", 
  FrontEnd`SelectionSetStyle[FontColor, RGBColor[{1, 0, 0}]];
  Print[CurrentValue["SelectionData"]]]

Update

Using the kernel, the following code does what I need:

Button["set", 
 SetOptions[NotebookSelection[InputNotebook[]], FontColor -> RGBColor[{0, .7, .5}]]; 
 Print[CurrentValue["SelectionData"]]]

I assume that FrontEnd`SelectionSetStyle can change the font color of the selection while using the front end only. If so, what is its syntax?

share|improve this question
    
After your update it is unclear what your question is. Can "what" be done in the front end only? –  Mike Honeychurch Oct 18 '13 at 20:42
    
@MikeHoneychurch: I re-worded the question, thank you for the note. –  Hector Oct 18 '13 at 22:12

1 Answer 1

Your assumptions are most probably wrong, it seems that this function is meant to change CellStyle.

e.g. use this code to convert Input cells to Title cells in current notebook:

(
 SelectionMove[#, All, Cell];
 MathLink`CallFrontEnd[FrontEnd`SelectionSetStyle[#, "Title"]]
   ) & /@ Cells[CellStyle -> "Input"]

Used here: Set the style of a cell (link corrected)

Found there: How can I get the style of a CellObject?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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