Skip to content

Commit

Permalink
chore: changed variable name, docs: updated README file
Browse files Browse the repository at this point in the history
  • Loading branch information
smalik authored and shameerrehman committed Aug 29, 2023
1 parent 73b94ef commit a8daa53
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,22 @@ started this project [here](blue.verto.health/advancing-accessibility-with-astra
- Text Size
- Text Spacing
- Screen Mask
- Line Height
- More to come!

| Key | Capability |
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Screen Reader | Screen reader is a tool where it would reads out texts on screen where user clicks on. For any html elements, if an aria label is available, the content from aria label would be read out loud, otherwise, it reads the text content of the element. There are 3 different speeds, normal, fast and slow. |
| Contrast | Contrast is a tool that removes background and replaces it with black or white to increase the difference in colours between text and the background to increase legibility. There are 3 modes, the invert colours, high contrast, and dark high contrast. |
| Saturation | Saturation is a tool that adjusts how colourful the colours are on screen, it has 3 different modes to lower saturation, increase saturation, or remove all the colours on screen (black and white). |
| Bigger Text | Bigger Text is a tool that increases the size of the texts on screen. |
| Text Spacing | Text Spacing is a tool that increases the spacing between each character on the screen to increase legibility and readibility. |
| Screen Mask | Screen Mask is a tool which dims the background and has a smaller focused area which follows the cursor sliding up and down the page. |
| Line Spacing | Line Spacing is a tool which increases the space between lines for greater readability. |




## Usage

Astral is built with Angular Elements. You can use it in your website in under 30 seconds. To add it, simply include the Javascript and initialize it:
Expand All @@ -40,7 +54,7 @@ Optionally we can choose which widgets should appear by passing an object inside
```html
<script>
initializeAstral({
filterWidget: ["Contrast", "Bigger Text", "Screen Mask"],
enabledFeatures: ["Screen Reader", "Contrast", "Saturation", "Text Size", "Text Spacing", "Screen Mask", "Line Height"]
});
</script>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
<!-- <div class="action">
<astral-invert></astral-invert>
</div> -->
<div class="action" *ngIf="this.filterWidget.includes('Screen Reader')">
<div class="action" *ngIf="this.enabledFeatures.includes('Screen Reader')">
<astral-screen-reader></astral-screen-reader>
</div>
<div class="action" *ngIf="this.filterWidget.includes('Contrast')">
<div class="action" *ngIf="this.enabledFeatures.includes('Contrast')">
<astral-contrast></astral-contrast>
</div>
<div class="action" *ngIf="this.filterWidget.includes('Saturation')">
<div class="action" *ngIf="this.enabledFeatures.includes('Saturation')">
<astral-saturate></astral-saturate>
</div>
<div class="action" *ngIf="this.filterWidget.includes('Bigger Text')">
<div class="action" *ngIf="this.enabledFeatures.includes('Bigger Text')">
<astral-text-size></astral-text-size>
</div>
<div class="action" *ngIf="this.filterWidget.includes('Text Spacing')">
<div class="action" *ngIf="this.enabledFeatures.includes('Text Spacing')">
<astral-text-spacing></astral-text-spacing>
</div>
<div class="action" *ngIf="this.filterWidget.includes('Screen Mask')">
<div class="action" *ngIf="this.enabledFeatures.includes('Screen Mask')">
<astral-screen-mask></astral-screen-mask>
</div>
<div class="action" *ngIf="this.filterWidget.includes('Line Height')">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export class AstralAccessibilityComponent {
astralAccessibilityPanel = "astral-modal";
astralAccessibilityIcon = "astral-icon";
options: Record<string, any> = {};
filterWidget: String[] = [];
enabledFeatures: String[] = [];

ngOnInit() {
const astralElement = document.querySelector("astral-accessibility");
const astralOptions = astralElement?.getAttribute("astral-options");
const astralElement = document.querySelector('astral-accessibility');
const astralOptions = astralElement?.getAttribute('astral-features');

if (astralOptions) {
this.options = JSON.parse(astralOptions);
this.filterWidget = this.options["filterWidget"];
this.enabledFeatures = this.options['enabledFeatures'];
}

const phones =
Expand Down
26 changes: 6 additions & 20 deletions projects/astral-accessibility/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@ import { createApplication } from "@angular/platform-browser";
import { AstralAccessibilityComponent } from "./lib/astral-accessibility.component";
import "zone.js";

(window as any).initializeAstral = async function initializeAstral(
options?: Record<string, any>,
) {
(window as any).initializeAstral = async function initializeAstral(features?: Record<string, any>) {
try {
//When no options are given by default all widgets are allowed
if (!options) {
options = {
filterWidget: [
"Screen Reader",
"Contrast",
"Saturation",
"Bigger Text",
"Text Spacing",
"Screen Mask",
],
if (!features) {
features = {
enabledFeatures: ["Screen Reader", "Contrast", "Saturation", "Text Size", "Text Spacing", "Screen Mask", "Line Height"]
};
}

Expand All @@ -29,13 +20,8 @@ import "zone.js";
customElements.define("astral-accessibility", widget);

const doc = app.injector.get(DOCUMENT);
const astralAccessibilityElement = doc.createElement(
"astral-accessibility",
);
astralAccessibilityElement.setAttribute(
"astral-options",
JSON.stringify(options),
);
const astralAccessibilityElement = doc.createElement('astral-accessibility');
astralAccessibilityElement.setAttribute('astral-features', JSON.stringify(features));
doc.body.appendChild(astralAccessibilityElement);
} catch (err) {
console.error(err);
Expand Down

0 comments on commit a8daa53

Please sign in to comment.