Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F21589543
color.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
701 B
Referenced Files
None
Subscribers
None
color.ts
View Options
import
{
Context
,
Field
}
from
"../../../main.js"
;
import
ColorParser
from
"color"
;
//putting it here not to slow down `new Sealious.app()`
export
default
class
Color
extends
Field
<
string
>
{
typeName
=
"color"
;
async
isProperValue
(
context
:
Context
,
new_value
:
string
)
{
try
{
if
(
typeof
new_value
===
"string"
)
{
ColorParser
(
new_value
.
toLowerCase
());
}
else
{
ColorParser
(
new_value
);
}
return
Field
.
valid
();
}
catch
(
e
)
{
return
Field
.
invalid
(
context
.
app
.
i18n
(
"invalid_color"
));
}
}
async
encode
(
_
:
any
,
value
:
string
|
null
)
{
if
(
value
===
null
)
{
return
null
;
}
const
color
=
ColorParser
(
value
);
return
color
.
hex
();
}
getTypeName
=
()
=>
"color"
;
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 7, 18:08 (6 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1182069
Default Alt Text
color.ts (701 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline