Reputation: 96274
How can I specify the color for a piece of text that Emacs Org-Mode should use when exporting the file to HTML?
e.g.
* Here is one bullet
** Here is another bullet
Here is some text that I want in BOLD RED
Here is some other text that I want in the default face
Upvotes: 4
Views: 3566
Reputation: 6115
org-special-block-extras
provides several convenient extra blocks for the HTML and LaTeX exporting options of org-mode; one of which is in-place coloring with
[[color:COLOR_NAME][text]]
For example,
* Here is one bullet
** Here is another bullet
Here is some text that I want in *[[color:red][BOLD RED]]*
Here is some other text that I want in the default face
Upvotes: 0
Reputation: 1637
Another way.
* Here is one bullet
** Here is another bullet
#+begin_html
Here is some text that I want in <span style='color:red'>BOLD RED</span>
#+end_html
Here is some other text that I want in the default face
Upvotes: 1
Reputation: 4506
Jeffrey gave the answer. However, to add extra information, please know that I'm busy making an org-macros project on GitHub, with the goal of making such behaviors a breeze.
The project is still in draft (the macros won't export correctly to LaTeX), full doc is not yet available (while it's OK, but you should look at the Org source for the real usage syntax, though), but if you clone https://github.com/fniessen/org-macros, you should be able to use either the "bgcolor", the "color" or the "highlight" macro (after INCLUDE'ing the org-macros.setup file in your Org document).
You would write:
INCLUDE: path/to/org-macros.setup
Here is some text that I want in *{{{color(red, BOLD RED)}}}*.
When I'll have those macros in a finished state, they will work for both HTML and LaTeX (at least).
Upvotes: 7
Reputation: 1712
You don't say if this is a one-off or not. css stylesheet makes sense if you need styles. To just do what you describe once, you can include the HTML directive for red in your org file, as follows:
Here is some text that I want in *@@html:<font color = "red">@@BOLD RED@@html:</font>@@*
See the section Quoting HTML tags in the Org manual.
Upvotes: 7
Reputation: 4029
You can have a custom css stylesheet linked to your exported html document by using the HTML HEAD option:
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
Take a look at the exported html and the classes that get assigned to different org levels and you should be able to put together a fairly simple stylesheet in no time. There's a good example of one here: https://gist.github.com/mowen/326524
Here is a reference: http://orgmode.org/manual/CSS-support.html#CSS-support
Upvotes: 1