Comments (2)
This is a great idea. It could even be built into the UI of the plugin as sort of a wizard. Something like:
- Select the CSS file you'd like to generate a config for
- Define any class toggles
- The plugin can the display a list of all CSS variables and allow the user to select a type, output format, write a description, etc
- Allow the user to add headings/section and drag and drop to arrange everything
This would be a big task, but could really improve the usability of the style-settings plugin
from obsidian-style-settings.
I was actually thinking of making something similar to this before I found style-settings. Based on this css-tricks article I wrote this snippet, which might come in handy for building out this feature:
function getCSSVars() {
const cssVarFilter = propName => propName.trim().indexOf("--") === 0;
const sheetToDictionary = sheet => {
let dict = {};
for (const rule of [...sheet.cssRules]) {
if (rule.type === 1) {
const props = [...rule.style].filter(cssVarFilter);
for (const propName of props) {
const key = propName.trim()
if (dict[key] === undefined) {
dict[key] = [];
}
dict[key].push(rule.style.getPropertyValue(propName).trim())
}
}
}
return dict;
};
return [...document.styleSheets]
.map(sheetToDictionary)
.filter(dict => Object.entries(dict).length > 0)
}
Its an improved version of the code from the article, for every stylesheet it creates a map of variables and the values being set to them. Since variables can be set and then changed, I'm storing all their possible values in an array and so we'll end up with a key and all values ever assigned to that key.
The issues with this approach is its hard to identify the stylesheets. The only accurate way is to look at the content of the sheets. Though it seems like the second sheet is always obsidian's main stylesheet, the fourth is always the theme + snippets (sadly these are merged together).
Idk if this would help, I salvaged this from a trashed plugin prototype from earlier today before I found this plugin.
from obsidian-style-settings.
Related Issues (20)
- No Color Override for Maroon HOT 4
- Feature Request: Not change the default link color
- FR add obsidian uri for local files
- where folder in my desktop I should add file css? HOT 1
- Highlight Colour Not Changing in Mobile
- Horizontal scroll on Code Blocks HOT 1
- Create starter file using the plugin itself
- Slows down Obsidian
- HUGE BUG: Background is Dark-Purple instead of BLACK on Many Dark Themes ! HOT 1
- suddenly the task checkboxes and some other boxes are pure white instead of grey
- Theme Request: Catppuccin HOT 1
- Implementation suggestion: Preview below the title HOT 1
- With Minimal theme, editing text in table cell always places cursor at cellโs left edge HOT 1
- Obsidian Update to 1.5.8 breaks all custom styles HOT 1
- Is there a JSON schema for the config? HOT 1
- How to merge two settings definitions into one?
- Link colors cannot be separated in internal and external link-color HOT 10
- Problem and workaround: All of my styles went away when "NANNANNAN" showed up in a style -- the GUI for color picking has a bug
- Bug: Toggle command adds three empty lines before frontmatter YAML HOT 3
- Feature Request: Change setting via frontmatter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obsidian-style-settings.