Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
62 changes: 35 additions & 27 deletions build/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ async function getColors() {
}

async function getIcons() {
let icons = {};

//get icons from atom's file-icons package
let rules = (await loadLess(sourceDir('atom/styles/icons.less')));
let icons = {};
let colors = (await resolveColors());
for(let [selector, properties] of Object.entries(rules)) {
let match;
if((match = /^.(?<name>[\w-]+)-icon:before$/.exec(selector))) {
Expand All @@ -137,13 +139,18 @@ async function getIcons() {
let codePoint;
if(content.startsWith('\\')) codePoint = parseInt(content.slice(1), 16);
else if(content.length == 1) codePoint = content.charCodeAt(0);
else log.warn(`unknown code point: ${content}`)
icons[name] = {
fontFamily,
codePoint,
svg: (await resolveSVG(name, fontFamily, codePoint)),
color: (await resolveColor(name)),
};
else log.warn(`unknown code point: ${content}`);
if(colors[name]) {
let svg = (await resolveSVG(name, fontFamily, codePoint));
for(let { color, fileType } of Object.values(colors[name])) {
icons[fileType] = {
fontFamily,
codePoint,
svg,
color,
};
}
}
}
}
//get override icons
Expand Down Expand Up @@ -262,28 +269,29 @@ async function resolveTsv(tsvFile, codePoint) {
return _tsvMap[tsvFile][codePoint];
}

let _colorsMap;
async function resolveColor(name) {
if(!_colorsMap) {
_colorsMap = {};
let config = CSON.load(sourceDir('atom/config.cson'));
for(let { icon, colour: color, match } of Object.values(config.fileIcons)) {
if(color) {
if(Array.isArray(color)) color = color[0];
}
if(!color) {
if(Array.isArray(match)) {
let m;
//prefer color of the matched extension
if((m = match.find(m => m[0] == `.${icon}`))) color = m[1];
//else fallback to the first match that has color
else if((m = match.find(m => m[1]))) color = m[1];
}
function resolveColors() {
let colors = {};
let config = CSON.load(sourceDir('atom/config.cson'));
for(let [name, { icon, colour: color, match }] of Object.entries(config.fileIcons)) {
if(color) {
if(Array.isArray(color)) color = color[0];
}
if(!color) {
if(Array.isArray(match)) {
let m;
//prefer color of the matched extension
if((m = match.find(m => m[0] == `.${icon}`))) color = m[1];
//else fallback to the first match that has color
else if((m = match.find(m => m[1]))) color = m[1];
}
if(color) _colorsMap[icon] = color;
}
let fileType;
if(/^[\w-]$/.test(name)) fileType = name.toLowerCase();
else fileType = icon;
if(!colors[icon]) colors[icon] = [];
colors[icon].push({ color, fileType });
}
return _colorsMap[name];
return colors;
}

async function getSupportedIcons() {
Expand Down
60 changes: 0 additions & 60 deletions build/icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ binary:

blade: null

coffeescript:
alias: coffee

c++:
alias: cpp

c#:
alias: csharp

css:
alias: css3

csv: null

diff:
Expand All @@ -58,18 +46,6 @@ diff:

dotnet: null

ex:
alias: elixir

gruntfile:
alias: grunt

gulpfile:
alias: gulp

html:
alias: html5

image:
color: auto-cyan
svg:
Expand All @@ -87,20 +63,11 @@ liquid: null

log: null

markdownx:
alias: markdown

markup:
<<: *default
svg:
filename: ./src/octoicons/icons/file-code-24.svg

nodejs:
alias: node

note:
alias: markdown

pdf: null

plist: null
Expand All @@ -116,14 +83,8 @@ rails:

restructuredtext: null

scss:
alias: sass

settings: null

shell:
alias: terminal

slim: null

source:
Expand All @@ -134,27 +95,6 @@ sublime:
filename: ./src/AFileIcon/icons/svg/file_type_sublime.svg
trim: true

test_js:
alias: test-js

test_jsx:
alias: test-react

test_tsx:
alias: test-react

test_typescript:
alias: test-ts

todo:
alias: checklist

typescript:
alias: ts

visualstudio:
alias: vs

vue:
light:
color: '#4fc08d'
12 changes: 6 additions & 6 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions preferences/file_type_alacritty-alt.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_arttext.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_arttext4.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_asciidoc.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_buildkite.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_circle.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_cnab.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_cubit.tmPreferences

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.v</string>
<string>source.d</string>
<key>settings</key>
<dict>
<key>icon</key>
<string>file_type_v</string>
<string>file_type_d</string>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.bloc</string>
<string>source.docz</string>
<key>settings</key>
<dict>
<key>icon</key>
<string>file_type_bloc</string>
<string>file_type_docz</string>
</dict>
</dict>
</plist>
12 changes: 0 additions & 12 deletions preferences/file_type_dropbox.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_dvc.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_expo.tmPreferences

This file was deleted.

12 changes: 0 additions & 12 deletions preferences/file_type_github.tmPreferences

This file was deleted.

Loading