6
$\begingroup$

When I create a hyperlink in a notebook, the text is blue, like the user defined variables. (Any word in the title like Graph which is a M function is in black.) How can I change the color to something else, e.g. red? Everything I've tried so far, in the Option Inspector, or by editing the cell expression has not worked. I'm new to M and have only modest programming skills and might be missing something obvious. I have M10.2 on Windows 7.

$\endgroup$
5
  • $\begingroup$ Is this ok too? Hyperlink["www.google.com", BaseStyle -> Red]? $\endgroup$
    – Kuba
    Dec 14, 2015 at 21:25
  • $\begingroup$ @Kuba. This will work if you start the link with http:// $\endgroup$
    – MPR
    Dec 15, 2015 at 16:12
  • $\begingroup$ It didn't work for me unless I had the the prefix. @Kuba $\endgroup$
    – MPR
    Dec 15, 2015 at 16:16
  • $\begingroup$ Your solution is the simplest for a basic solution. $\endgroup$
    – MPR
    Dec 15, 2015 at 16:20
  • $\begingroup$ Let's assume Hyperlink["http://www.google.com", BaseStyle -> Red], what limitations are there? $\endgroup$
    – Kuba
    Dec 15, 2015 at 16:21

2 Answers 2

7
$\begingroup$

You can change the style of a hyperlink in your notebook by modifying its stylesheet.

  1. Open the Format>Edit stylesheet... menu. Private definitions stylesheet opens.
  2. Click on the blue "Default.nb" link. Default stylesheet opens.
  3. In the notebook that opens click on the blue "Core.nb". Core stylesheet opens
  4. Search for (using the Find dialog) for Hyperlink
  5. Copy the appropriate cell found this way to the first sheet that opened and change its style using the Format menu

In pictures:

A hyperlink in a notebook

Mathematica graphics

Step 1

Mathematica graphics

Step 2

Mathematica graphics

Step 3 & 4

Mathematica graphics

Step 5

Mathematica graphics

Result is visible immediately

Mathematica graphics Done.

$\endgroup$
1
  • $\begingroup$ The comments above and below are good for a simple link to a web site or the top of another notebook. To get to a tagged cell somewhere in another notebook, I had to create the link as shown here and then use the Insert->Hyperlink menu to get to the target cell. At that point, I can tweak the appearance $\endgroup$
    – MPR
    Dec 15, 2015 at 16:29
2
$\begingroup$

I you only want to have a custom style for one particular hyperlink, you can just write it as a Hyperlink call.

For example,

Hyperlink["Link: Mathematica.SE", 
  "http://mathematica.stackexchange.com/q/76971/3066", 
   BaseStyle -> {"Subsubsection"},
   ActiveStyle -> {Gray}]

Evaluate this and then hide or delete the code cell. (I prefer hiding.) Depending on your current stylesheet, you should see something like

inactive

when the link is inactive and

()

when the link is active (mouse cursor is over link).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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