Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
vue-pattern-placeholder
Advanced tools
This plugin provides a placeholder component for Vue.js. It uses canvas to render patterns from input string like URL.
To install this plugin, open terminal in your Vue project directory and type:
npm i --save-dev vue-pattern-placeholder
This command will install the plugin in your project node_modules
dir and
add it as a project development dependency in project's package.json
file.
If you need this plugin as a generic dependency, type this command instead:
npm i --save-dev vue-pattern-placeholder
To import a component, write:
import patternPlaceholder from 'vue-pattern-placeholder'
Add it to the components
property
components: {
patternPlaceholder
},
Now you can use it in your template:
<patternPlaceholder
:width="150" :height="150"
:input="''+item_data.media_id"
label="150x150"
label_style="900 30px Arial" label_color="#000"
:hue_range="[70, 170]"
:lightness_range="[0, 100]"
/>
I recommend to start playing with hue_range
and lightness_range
properties to reach the best look.
For now, none of the parameters are required.
Option | Data-type(s) | Description | Default |
---|---|---|---|
width | Number | width of an image | 250 |
height | Number | height of an image | 250 |
input | String | this text will be converted to a pattern | Hi there! :-) |
label | String | text label to show | No label |
label_style | String | canvas font style. Example: 900 30px Arial | 20px Helvetica bold |
label_color | String | color of a label. Example: #777 | #777 |
metric | String | metric, used to create a pattern. Examples: Euclidean, Manhattan, Minkovski | Manhattan |
debug | Boolean | allows to show center points for a Voronoi pattern | false |
hue_range | Array | sets a color range in degrees. Example: [0, 359] | [0, 359] |
lightness_range | Array | lightness range for pattern pieces in percents. Example: [0, 100] | [0, 100] |
Please be aware that this project is still in a testing stage. Use at your own risk. Ideas and bug reports are welcome.
I thought about converting text to an image and I remembered Voronoi patterns: these are easy to implement and look very nice.
Then I had an idea:
Thanks to AnatolV from RosettaCode for a nice Voronoi diagram implementation.
Thanks to emn178 for js-sha256 library. It is easy to use and helps a lot.
FAQs
Adds canvas patterns as placeholder images
The npm package vue-pattern-placeholder receives a total of 5 weekly downloads. As such, vue-pattern-placeholder popularity was classified as not popular.
We found that vue-pattern-placeholder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.