filetype-mask-icons 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +290 -0
  3. package/css/icons.css +18 -0
  4. package/package.json +30 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 O. Patrick Barnes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,290 @@
1
+ # filetype-mask-icons
2
+
3
+ A tiny set of file-type icons implemented as **CSS mask images**.
4
+
5
+ These icons inherit color from `currentColor`, which allows them to automatically adapt to **light mode, dark mode, and custom themes** without needing separate icon assets.
6
+
7
+ The icons are intentionally minimal and intended to represent common file types in interfaces such as file browsers, dashboards, and developer tools.
8
+
9
+
10
+ ---
11
+
12
+ # Quick Example
13
+
14
+ ```html
15
+ <div class="filetype-mask-icon"
16
+ style="--icon:var(--filetype-mask-icon-file); width:24px; height:24px;">
17
+ </div>
18
+ ```
19
+
20
+ ```css
21
+ .filetype-mask-icon{
22
+ display:inline-block;
23
+ background:currentColor;
24
+ mask:var(--icon) center / contain no-repeat;
25
+ -webkit-mask:var(--icon) center / contain no-repeat;
26
+ mask-mode:luminance;
27
+ }
28
+ ```
29
+
30
+ The icon color is inherited from `currentColor`, which means it automatically adapts to your theme.
31
+
32
+ ---
33
+
34
+ # Demo
35
+
36
+ A live demo of the icons is available here:
37
+
38
+ <https://opbarnes.github.io/filetype-mask-icons/demo/>
39
+
40
+ The demo shows:
41
+
42
+ - All available icons
43
+ - Multiple icon sizes
44
+ - Light and dark theme behavior
45
+
46
+ This allows you to see exactly how the icons render and how they inherit color from `currentColor`.
47
+
48
+ ---
49
+
50
+ # Why this exists
51
+
52
+ Traditional icon approaches often require:
53
+
54
+ - Separate icons for **light and dark themes**
55
+ - Inline SVG manipulation
56
+ - Multiple color variants
57
+
58
+ These icons use **CSS masking**, which allows the icon color to come directly from CSS.
59
+
60
+ Because of this:
61
+
62
+ - Icons automatically match surrounding text color
63
+ - They work with **light and dark themes**
64
+ - They can be styled with **hover effects, transitions, or theme variables**
65
+ - No separate dark/light icon sets are required
66
+
67
+ Example theme:
68
+
69
+ ```css
70
+ .light {
71
+ color: black;
72
+ }
73
+
74
+ .dark {
75
+ color: white;
76
+ }
77
+ ```
78
+
79
+ The icon automatically adapts to the theme.
80
+
81
+ ---
82
+
83
+ # Icon Set
84
+
85
+ Currently included icons:
86
+
87
+ - file
88
+ - folder
89
+ - image
90
+ - zip
91
+ - code
92
+ - video
93
+ - audio
94
+ - document
95
+
96
+ ---
97
+
98
+ # Demo
99
+
100
+ A visual demo of all icons and sizes is available here:
101
+
102
+ ```
103
+ demo/index.html
104
+ ```
105
+
106
+ Open this file in a browser to preview the icons and test light/dark mode behavior.
107
+
108
+ ---
109
+
110
+ # Installation
111
+
112
+ ## Using npm
113
+
114
+ If you are using a JavaScript build tool (such as Vite, Webpack, Parcel, etc.), install the package with npm:
115
+
116
+ ```bash
117
+ npm install filetype-mask-icons
118
+ ```
119
+
120
+ Then import the stylesheet into your project.
121
+
122
+ ### Import from JavaScript
123
+
124
+ Add the import to your main JavaScript entry file (for example `src/main.js`, `src/index.js`, or `src/main.ts`):
125
+
126
+ ```javascript
127
+ import "filetype-mask-icons/css/icons.css"
128
+ ```
129
+
130
+ ### Import from CSS
131
+
132
+ If your project has a main stylesheet (for example `src/style.css`, `src/main.css`, or similar), you can import it there instead:
133
+
134
+ ```css
135
+ @import "filetype-mask-icons/css/icons.css";
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Using Vite
141
+
142
+ Vite supports CSS imports directly.
143
+
144
+ Add the import to your main entry file (usually `src/main.js` or `src/main.ts`):
145
+
146
+ ```javascript
147
+ import "filetype-mask-icons/css/icons.css"
148
+ ```
149
+
150
+ Example `src/main.js`:
151
+
152
+ ```javascript
153
+ import "filetype-mask-icons/css/icons.css"
154
+ import "./style.css"
155
+ ```
156
+
157
+ No additional configuration is required.
158
+
159
+ ---
160
+
161
+ ## Using SCSS / Sass
162
+
163
+ If your project uses SCSS or Sass, import the stylesheet inside your SCSS file.
164
+
165
+ Example:
166
+
167
+ ```scss
168
+ @import "filetype-mask-icons/css/icons.css";
169
+ ```
170
+
171
+ Or using modern Sass syntax:
172
+
173
+ ```scss
174
+ @use "filetype-mask-icons/css/icons.css";
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Without npm
180
+
181
+ You can copy the stylesheet directly into your project:
182
+
183
+ ```
184
+ css/icons.css
185
+ ```
186
+
187
+ Then include it in your HTML:
188
+
189
+ ```html
190
+ <link rel="stylesheet" href="css/icons.css">
191
+ ```
192
+
193
+ ---
194
+
195
+ # Usage
196
+
197
+ Apply the `.filetype-mask-icon` class and set the `--icon` variable to one of the provided icon variables.
198
+
199
+ Example:
200
+
201
+ ```html
202
+ <div class="filetype-mask-icon"
203
+ style="--icon:var(--filetype-mask-icon-file); width:24px; height:24px;">
204
+ </div>
205
+ ```
206
+
207
+ The icon color comes from `currentColor`.
208
+
209
+ Example:
210
+
211
+ ```css
212
+ .file {
213
+ color: #444;
214
+ }
215
+
216
+ .dark .file {
217
+ color: #eee;
218
+ }
219
+ ```
220
+
221
+ The icon will automatically inherit the color.
222
+
223
+ ---
224
+
225
+ # Available icon variables
226
+
227
+ ```css
228
+ --filetype-mask-icon-file
229
+ --filetype-mask-icon-folder
230
+ --filetype-mask-icon-image
231
+ --filetype-mask-icon-zip
232
+ --filetype-mask-icon-code
233
+ --filetype-mask-icon-video
234
+ --filetype-mask-icon-audio
235
+ --filetype-mask-icon-doc
236
+ ```
237
+
238
+ ---
239
+
240
+ # Example
241
+
242
+ ```html
243
+ <div class="filetype-mask-icon"
244
+ style="--icon:var(--filetype-mask-icon-folder); width:32px; height:32px;">
245
+ </div>
246
+ ```
247
+
248
+ ---
249
+
250
+ # Customizing size
251
+
252
+ The icon size is controlled using normal CSS `width` and `height`.
253
+
254
+ You can set the size inline:
255
+
256
+ ```html
257
+ <div class="filetype-mask-icon"
258
+ style="--icon:var(--filetype-mask-icon-file); width:24px; height:24px;">
259
+ </div>
260
+ ```
261
+
262
+ Or define your own CSS classes:
263
+
264
+ ```css
265
+ .icon-small{
266
+ width:16px;
267
+ height:16px;
268
+ }
269
+
270
+ .icon-large{
271
+ width:48px;
272
+ height:48px;
273
+ }
274
+ ```
275
+
276
+ Then apply them to the element:
277
+
278
+ ```html
279
+ <div class="filetype-mask-icon icon-large"
280
+ style="--icon:var(--filetype-mask-icon-folder);">
281
+ </div>
282
+ ```
283
+
284
+ ---
285
+
286
+ # License
287
+
288
+ MIT License
289
+
290
+ See the `LICENSE` file for details.
package/css/icons.css ADDED
@@ -0,0 +1,18 @@
1
+ :root{
2
+ --filetype-mask-icon-file:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M6 2h9l5 5v15H6z'/></svg>");
3
+ --filetype-mask-icon-folder:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M3 6h6l2 2h10v10H3z'/></svg>");
4
+ --filetype-mask-icon-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='4' y='4' width='16' height='16' rx='1.5' ry='1.5' fill='white'/><path fill='black' d='M7 13l2-2 4 4 3-3 3 4H5z'/></svg>");
5
+ --filetype-mask-icon-zip:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M6 2L15 2L20 7L20 22L6 22Z'/><rect x='12.3' y='4.7' width='1' height='10.1' rx='0.2' fill='black'/><rect x='12.7' y='5.9' width='3' height='1.2' rx='0.15' fill='black'/><rect x='10' y='7.9' width='3' height='1.2' rx='0.15' fill='black'/><rect x='12.7' y='10' width='3' height='1.2' rx='0.15' fill='black'/><rect x='10' y='11.9' width='3' height='1.2' rx='0.15' fill='black'/><rect x='11.2' y='14.5' width='3.3' height='1.2' rx='0.15' fill='black'/><path fill='black' d='M10.56 19.52L11.77 15.6H13.83L15.04 19.52Z'/></svg>");
6
+ --filetype-mask-icon-code:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M6 2h9l5 5v15H6z'/><g fill='none' stroke='black' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'><polyline points='14.5 14.5 17.5 12 14.5 9.5'/><polyline points='11.5 9.5 8.5 12 11.5 14.5'/></g></svg>");
7
+ --filetype-mask-icon-video:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='4' y='4' width='16' height='16' rx='1.5' ry='1.5' fill='white'/><rect x='7' y='7' width='7.6' height='10' rx='0.9' ry='0.9' fill='black'/><path fill='black' d='M14.3 10l3-1.5v7l-3-1.5z'/></svg>");
8
+ --filetype-mask-icon-audio:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='4' y='4' width='16' height='16' rx='1.5' ry='1.5' fill='white'/><path fill='black' stroke='black' stroke-width='1' stroke-linejoin='round' d='M8.7 10v4h2.8l3.8 3.8V6.2L11.5 10Z'/></svg>");
9
+ --filetype-mask-icon-doc:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M6 2h9l5 5v15H6z'/><g fill='none' stroke='black' stroke-width='1' stroke-linecap='round'><path d='M8.5 11h9'/><path d='M8.5 14h9'/><path d='M8.5 17h9'/></g></svg>");
10
+ }
11
+
12
+ .filetype-mask-icon{
13
+ display:inline-block;
14
+ background:currentColor;
15
+ mask:var(--icon) center / contain no-repeat;
16
+ -webkit-mask:var(--icon) center / contain no-repeat;
17
+ mask-mode:luminance;
18
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "filetype-mask-icons",
3
+ "version": "1.0.0",
4
+ "description": "A tiny set of file-type icons implemented as CSS mask images, designed to inherit color from currentColor for easy theming and dark-mode support.",
5
+ "keywords": [
6
+ "css",
7
+ "icons",
8
+ "mask",
9
+ "filetype",
10
+ "file-icons",
11
+ "filetype-icons",
12
+ "css-mask",
13
+ "svg-icons",
14
+ "minimal-icons"
15
+ ],
16
+ "author": "O. Patrick Barnes",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/opbarnes/filetype-mask-icons.git"
21
+ },
22
+ "homepage": "https://github.com/opbarnes/filetype-mask-icons",
23
+ "files": [
24
+ "css"
25
+ ],
26
+ "style": "css/filetype-mask-icons.css",
27
+ "scripts": {
28
+ "test": "echo \"Error: no test specified\" && exit 1"
29
+ }
30
+ }