Background colour for RTF notes

Thanks very much, I’ll take a look at that.

Where exactly did you find this file? I don’t see anything like that anywhere in either ~/Library/Application Support/DEVONthink or ~/Library/Application Support/DEVONthink 3.
Did you create it yourself?

A Formatted Note is HTML. HTML tags can have a style attribute containing inline CSS, which is what @BLUEFROG’s example demonstrated.

<element style="CSS HERE">

I think the suggestion was to create a new formatted note and edit the style attribute of the body element to your liking, then export it as a template (like with the RTF).
Note that editing the HTML source of formatted notes is only possible with an external text editor.

I guess you could also link to an external style sheet in the template file. But my impression is the point of a formatted note is to be a self-contained document.

Either way, @chrillek’s guide is a great way to get started with CSS.

1 Like

My example is specifically editing the body element and, other than needing to employ a third-party editor, is incredibly simple. This is the entire markup…

<html dir="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="DT:isEditableNote" content="Yes"/>
<style>
</style>
</head>
<body style="margin:1.5em; font-family:sans-serif; font-size:1rem; background-color:#FFEDD9;">
</body>
</html>

Colored Note.html.zip (933 Bytes)

Indeed :slight_smile: It just seemed like @Firebell76 didn’t really know what to do with your example, so I added a little context.

1 Like

Where exactly did you find this file? I don’t see anything like that anywhere in either ~/Library/Application Support/DEVONthink or ~/Library/Application Support/DEVONthink 3.
Did you create it yourself?

If I’m totally honest it started life as the formatted document file in the DT Package. I did a copy, moved it out of the package and then worked on that with the intention of exporting as “MY Formatted Doc”. I thought modifying it to use @blueforg’s suggestions would do the trick but my knowledge of css is waaay out of date. FWIW I used BBEdit my text editor of choice.

I thought it might be an easy way in but obviously not….

See my reply to @troejgaard below. Over the weekend I’ll have a look at the code you’ve kindly posted as well as @chrillek’s CSS for Markdown.

Once I’ve got this set up there will probably be another thread on databases and exporting material from one to another. Until I get a bit further with setting up the new machine that will wait a while.

Many thanks to all for the help.

Ah. I guess that’s the internal style sheet DT uses as the baseline for displaying formatted notes. But it’s a CSS file. As mentioned above, formatted notes are HTML files. Storing some CSS file among your templates doesn’t alter the display of formatted notes, even if you name it Formatted Note.css.

Note: It is unwise to be poking around inside the application package.


Did you download the ZIP file I uploaded? What you’re asking about is incredibly simple and the file I provided has the code already intact.

on databases and exporting material from one to another.

On another note: It seems you’re approaching things with certain ideas that may be overcomplicating things for you. For example, your comment about “exporting material from one to another” concerns me you’re using terminology or ideas that likely are misleading you. If you were moving things around in the Finder, would you be thinking about exporting and importing into different folders? Likely not. So approach DEVONthink with the same approach you’d use in the Finder.

Which is why I copied the file and moved it outside the app bundle :grinning_face:

Did you download the ZIP file I uploaded? What you’re asking about is incredibly simple and the file I provided has the code already intact.

Yes I did and that works absolutely fine thanks.

I was regarding a css file as a text file working in the same manner as plain html, which it doesn’t.

Regarding databases, I have a lot of stuff to import from other apps so import is probably the correct term for that. However, this may create a lot of duplicates within the existing database, somehting I want to avoid. This is purely exploratory at the moment but is it better to:

Import and deal with the duplicates. Tedious but does work.

Create another database and select what I believe to be unique items and then import/move these to the new database.

Not sure how many databases DT can have open as I’ve only ever used one, but your post suggests it may be as simple as drag and drop whilst in DT. Hopefully that is the case.
As I say, I’m simply kicking around ideas at the moment. Previous experience with databases tells me it’s easy to create an unholy mess from which it’s difficult to recover, so I want to have a clear idea of what I’m doing before I start. Needless to say I do have backups……

Following on from this I’ve been modifying the RTF templates to create templates with different cloured backgrounds to indicate different purposes. EG notes on an archive document, project briefs and so on. This has gone well so far.

However I’ve been attempting to modify the line spacing. All goes well using the DT dropdown format menu for line spacing. Adjust this to 1.1 spacing, save as a template but then when I try to create a new doc from that template it reverts to 1.3 line spacing.
I’ve now run out of ideas. Has anyone any idea where I’m going wrong?

Not sure how to attach a file so the link to the offending RTF template should do the trick.

https://ln5.sync.com/dl/4d4f47600#pi8wtwyu-ih7ubz49-n4p7asvc-jpz498av

Edited to correct link

OK I’ve found the cause. In settings the line spacing is set to 1.3 so any new file defaults to that. TBH I should have looked there earlier but that’s on me.

However, it would surely be better if all template settings, including line spacing are allowed to override the defaults, so all settings in the template take precedence. Otherwise there’s not much point in creating a template.

Don’t know if the Devs will see this but if they do, please take it as a feature request.

ADDITIONAL NOTE: Just to add to this, I think what I suggest is doable as the Note in: Templates → Productivity → Note.dtemlpate→ English.lproj takes precedence over the default settings. Within the English.lproj folder there is what appears to be a standard RTF file.

Using @BLUEFROG’S method upthread and substituting my own RTF file doesn’t work, so there must be some code preventing it. That suggests only the devs can create such a modified RTF file within a X.dtemplate → English.lproj folder,

RTF templates already preserve the linespacing. This is a document I just created, with a line of text to establish the linespacing of 2.0, then exported as a simple template. Upon using the template…

In settings the line spacing is set to 1.3 so any new file defaults to that.

It is unclear what you’re saying here, but if you mean “using Data > New > Rich Text”, then logically it will honor the Editing settings. You have to use your template in order to have your own custom settings.

Not sure we’re talking at cross purposes. I set up a template according to your method upthread. Set line spacing at (Say1.5) and then save it. Then Export as template. Then using the new template: : Data → new from template → "the new template”, the spacing has dropped back to the default in settings.

I’m clearly missing something but I’m at a loss to understand what it is. Background color as we discussed upthread works fine thanks to your very clear instructions, it’s the line spacing I can’t get to ‘stick’. My feeling is if you export as a template, the template settings should overide the defaults in global settings.

Think I see where I’m going wrong. When doing the spacing I need to leave some text at the top of the template in order to retain the line spacing. I have been creating a couple of lines of text to set the spacing but then deleted it as superfluous so I would be working from a blank page. However, it’s the saved text that ‘fixes’ the line spacing; with no text it defaults to the global setting, even though it’s exported as a template rather than a plain RTF file.

Think that’s correct :grinning_face:

Yes, that’s correct. Linespacing, fonts, etc. are tied to text so you should have some dummy/boilerplate text in the document. That’s also helpful for actually seeing what the formatting in the document will be.

Thanks very much for all your help. I can now carry on with actually using DT…. :grinning_face:

You’re welcome.
Have a good upcoming week.