diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6083dde --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +screenshots/*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/autodl.yml b/.github/workflows/autodl.yml new file mode 100644 index 0000000..039af62 --- /dev/null +++ b/.github/workflows/autodl.yml @@ -0,0 +1,36 @@ +name: Auto download colour backup data +on: + schedule: + - cron: 0 10 15 1,7 * + workflow_dispatch: +jobs: + download: + name: Download colour data + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download colours data + shell: pwsh + run: .\fetch.ps1 + - name: Config Git + run: | + git config --local user.name "Colour fetch" + git config --local user.email "enquiry@rk0cc.xyz" + - name: Check differences + id: difference + run: git diff --quiet + continue-on-error: true + - name: Add and commit + if: steps.difference.outcome == 'failure' + run: | + git add . + git commit -m "Update colour backup data" + - name: Push + if: steps.difference.outcome == 'failure' + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: main diff --git a/.pubignore b/.pubignore index cfba1fb..de9b901 100644 --- a/.pubignore +++ b/.pubignore @@ -9,3 +9,5 @@ /example/pubspec.lock /example/pubspec.yaml /example/README.md +/colour_download.ps1 +/fetch.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dd004c..d19b2b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,42 @@ +## 3.2.3 + +* Uses `fetch` API for web + +## 3.2.2 + +* Migrate to `package:web` +* Require Dart 3.3 or above + +## 3.2.1 + +* Fix performing checksum before decompress cached colour data. + +## 3.2.0 + +* Replace web caching storage library from `shared_preference` to `sembast_web` for native Blob supported. +* Apply trimmed `color.json` which removes unused fields. +* Apply class extension scope. + +## 3.1.0 + +* Drop Dart 2 support +* Mark some classes as immutable +* Improved source code directory layout +* Lints + +## 3.0.0 + +* Dart 3 supported +* Uses `hashlib` to replace `sha3` and `hex` + * **If encounter hashing mismatch error, please clean cache and launch again.** +* All deprecated API removed +* Update `color.json` +* `getInstance` becomes deprecated and uses `initialize` instead. + +## 2.0.0+1 + +* Fix document + ## 2.0.0 * `GitHubColour` implemented with `ColorSwatch` and `UnmodifiableMapBase` now. diff --git a/README.md b/README.md index e57225f..23382ba 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ You can either initalized `GitHubColour` before `runApp(Widget)` (Call it after // With offline last resort void main() async { WidgetsFlutterBinding.ensureInitialized(); - await GitHubColour.getInstance(); + await GitHubColour.initialize(); runApp(const YourApp()); } // Without offline last resort void main() async { - await GitHubColour.getInstance(offlineLastResort: false); + await GitHubColour.initialize(offlineLastResort: false); runApp(const YourApp()); } ``` @@ -33,40 +33,17 @@ class YourAppWidget extends StatelessWidget { @override Widget build(BuildContext context) => Scaffold( appBar: AppBar( - backgroundColor: GitHubColour.getExistedInstance().find("Go") + backgroundColor: GitHubColour.getExistedInstance()["Go"] ) ); } ``` -or wrapped into `FutureBuilder` with initalized `Future` variable from `State`'s `initState` (not recommended uses `getInstance()` directly in `FutureBuilder`): - -```dart -class _YourAnotherAppWidgetState extends State { - late final Future _ghc; - - @override - void initState() { - super.initState(); - _ghc = GitHubColour.getInstance(); - } - - @override - Widget build(BuildContext context) => FutureBuilder( - future: _ghc, - builder: (context, snapshot) { - // Implement whatever you want - } - ); -} -``` - ## Cache for connection failed -This package supported caching system as a backup when making request failed. It uses LZMA compress data and store as a file under temporary directory (for VM) -or store as `shared_preference` (for Web, which is `LocalStorage`). +This package supported caching system as a backup when making request failed. It uses LZMA compress data and store as a file under temporary directory (for VM) or store under `sembast_web` (based on IndexedDB, `3.1.0` or before was using `shared_preference`). -If no cache available, by default, `GitHubColour.getInstance()` will uses [local's `colors.json`](lib/colors.json) as last resort. However, this package will not synchronized when newer commit of `color.json` pushed since it minified that ensure the package can be downloaded as fast as possible. +If no cache available, when executing `GitHubColour.initialize()`, it will uses [local's `colors.json`](lib/colors.json) as last resort. However, this package will not synchronized when newer commit of `color.json` pushed since it minified that ensure the package can be downloaded as fast as possible. ## Note for American English developers diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/.gitignore b/example/.gitignore index 516dfaf..aade2e7 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -22,7 +22,6 @@ # Flutter/Dart/Pub related # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. -/pubspec.lock **/doc/api/ .dart_tool/ .packages diff --git a/example/.metadata b/example/.metadata index 3c3e4b5..784ce12 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,27 @@ # This file should be version controlled and should not be manually edited. version: - revision: 5464c5bac742001448fe4fc0597be939379f88ea - channel: stable + revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + - platform: web + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/lib/main.dart b/example/lib/main.dart index 504fb7d..cb5bc98 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -5,31 +5,28 @@ void main() async { // Required if want to uses offline JSON data as last resort. WidgetsFlutterBinding.ensureInitialized(); // Construct an instance for future uses. - await GitHubColour.getInstance(); + await GitHubColour.initialize(); // It does not required binding if disabled offline last resort /* - await GitHubColour.getInstance(offlineLastResort: false); + await GitHubColour.initialize(offlineLastResort: false); */ runApp(const App()); } class App extends StatelessWidget { - const App({Key? key}) : super(key: key); + const App({super.key}); @override Widget build(BuildContext context) => MaterialApp( - title: 'GitHub Language colour', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: const GitHubColourDemo(), - ); + title: 'GitHub Language colour', + theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false), + home: const GitHubColourDemo()); } class GitHubColourDemo extends StatefulWidget { - const GitHubColourDemo({Key? key}) : super(key: key); + const GitHubColourDemo({super.key}); @override State createState() => _GitHubColourDemoState(); @@ -82,6 +79,6 @@ class _GitHubColourDemoState extends State { width: 80, height: 35, child: ElevatedButton( - child: const Text("Apply"), onPressed: _changeColour)) + onPressed: _changeColour, child: const Text("Apply"))) ]))); } diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index 766b5cf..a1cdfd0 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,12 +5,10 @@ import FlutterMacOS import Foundation -import path_provider_macos -import shared_preferences_macos +import path_provider_foundation import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/example/pubspec.lock b/example/pubspec.lock new file mode 100644 index 0000000..24f3ac2 --- /dev/null +++ b/example/pubspec.lock @@ -0,0 +1,412 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fetch_api: + dependency: transitive + description: + name: fetch_api + sha256: "97f46c25b480aad74f7cc2ad7ccba2c5c6f08d008e68f95c1077286ce243d0e6" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + fetch_client: + dependency: transitive + description: + name: fetch_client + sha256: "9666ee14536778474072245ed5cba07db81ae8eb5de3b7bf4a2d1e2c49696092" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + ffi: + dependency: transitive + description: + name: ffi + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + font_awesome_flutter: + dependency: "direct main" + description: + name: font_awesome_flutter + sha256: "275ff26905134bcb59417cf60ad979136f1f8257f2f449914b2c3e05bbb4cd6f" + url: "https://pub.dev" + source: hosted + version: "10.7.0" + github_colour: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "3.2.3" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: "2776c66b3e97c6cdd58d1bd3281548b074b64f1fd5c8f82391f7456e38849567" + url: "https://pub.dev" + source: hosted + version: "4.0.5" + hashlib: + dependency: transitive + description: + name: hashlib + sha256: d41795742c10947930630118c6836608deeb9047cd05aee32d2baeb697afd66a + url: "https://pub.dev" + source: hosted + version: "1.19.2" + hashlib_codecs: + dependency: transitive + description: + name: hashlib_codecs + sha256: "2b570061f5a4b378425be28a576c1e11783450355ad4345a19f606ff3d96db0f" + url: "https://pub.dev" + source: hosted + version: "2.5.0" + http: + dependency: transitive + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + idb_shim: + dependency: transitive + description: + name: idb_shim + sha256: "0ae356560abbd07d2bd38165c5f3d9bc4fe9d1e73cdb5ed22691052d63bfdd4b" + url: "https://pub.dev" + source: hosted + version: "2.6.0+5" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + lzma: + dependency: transitive + description: + name: lzma + sha256: d7d003f9d6bcffe293684d0a1d0768592aa488db6315f2a9d031f00e6f0c245f + url: "https://pub.dev" + source: hosted + version: "1.0.1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + meta: + dependency: transitive + description: + name: meta + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + url: "https://pub.dev" + source: hosted + version: "2.1.4" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "490539678396d4c3c0b06efdaab75ae60675c3e0c66f72bc04c2e2c1e0e2abeb" + url: "https://pub.dev" + source: hosted + version: "2.2.9" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + url: "https://pub.dev" + source: hosted + version: "2.4.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + sembast: + dependency: transitive + description: + name: sembast + sha256: "20990ecc60a83a3ac0633eb42e73b3e8556e1c93399ea963878b7e4ffa7ded6a" + url: "https://pub.dev" + source: hosted + version: "3.7.1+3" + sembast_web: + dependency: transitive + description: + name: sembast_web + sha256: "6b15b49b2a86214130c25c7bdfb3a76eb0f4dc5e43016087f03870bd0bf9ba07" + url: "https://pub.dev" + source: hosted + version: "2.4.0+2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "94d8ad05f44c6d4e2ffe5567ab4d741b82d62e3c8e288cc1fcea45965edf47c9" + url: "https://pub.dev" + source: hosted + version: "6.3.8" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" + source: hosted + version: "1.0.4" +sdks: + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2a3a1f5..7129e86 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,19 +1,19 @@ name: example description: A new Flutter project. publish_to: 'none' -version: 1.0.0+2 +version: 2.0.1 environment: - sdk: ">=2.16.2 <3.0.0" + sdk: ">=3.4.0 <4.0.0" dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 github_colour: path: '../' - url_launcher: ^6.1.0 - font_awesome_flutter: ^10.1.0 - google_fonts: ^2.3.2 + url_launcher: ^6.1.11 + font_awesome_flutter: ^10.4.0 + google_fonts: ^4.0.5 dev_dependencies: - flutter_lints: ^1.0.0 + flutter_lints: ^3.0.1 flutter: uses-material-design: true diff --git a/example/web/index.html b/example/web/index.html index b6b9dd2..3c856dc 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -1,24 +1,9 @@ - - - - + @@ -33,72 +18,6 @@ - - + diff --git a/example/web/manifest.json b/example/web/manifest.json index 096edf8..c27fea3 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -5,7 +5,7 @@ "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "A new Flutter project.", + "description": "Web demo of flutter_github_colour.", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ diff --git a/example/windows/runner/Runner.rc b/example/windows/runner/Runner.rc index 5fdea29..0f5c085 100644 --- a/example/windows/runner/Runner.rc +++ b/example/windows/runner/Runner.rc @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" // Version // -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD #else -#define VERSION_AS_NUMBER 1,0,0 +#define VERSION_AS_NUMBER 1,0,0,0 #endif -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION #else #define VERSION_AS_STRING "1.0.0" #endif diff --git a/fetch.ps1 b/fetch.ps1 new file mode 100644 index 0000000..2e3edf5 --- /dev/null +++ b/fetch.ps1 @@ -0,0 +1,26 @@ +function Request-ColourData { + $colourDataUri = "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" + + $webReq = Invoke-WebRequest -Uri $colourDataUri + $status = $webReq.StatusCode + + if ($status -ne 200) { + throw "Unable to obtain data due to HTTP error (status code: " + $status + ")" + } + + return $webReq.Content +} + +$colourJson = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath "lib") -ChildPath "colors.json" + +$colourObj = Request-ColourData | ConvertFrom-Json + +foreach ($lang in $colourObj.PSObject.Properties) { + foreach ($info in $lang.Value) { + if ($info | Get-Member -Name "url") { + $info.PSObject.Properties.Remove("url") + } + } +} + +ConvertTo-Json -Compress $colourObj | Out-File -FilePath $colourJson -Encoding utf8 -Force diff --git a/lib/colors.json b/lib/colors.json index 96a6b2c..c34f299 100644 --- a/lib/colors.json +++ b/lib/colors.json @@ -1 +1 @@ -{"1C Enterprise":{"color":"#814CCC","url":"https://github.com/trending?l=1C-Enterprise"},"2-Dimensional Array":{"color":"#38761D","url":"https://github.com/trending?l=2-Dimensional-Array"},"4D":{"color":"#004289","url":"https://github.com/trending?l=4D"},"ABAP":{"color":"#E8274B","url":"https://github.com/trending?l=ABAP"},"ABAP CDS":{"color":"#555e25","url":"https://github.com/trending?l=ABAP-CDS"},"ActionScript":{"color":"#882B0F","url":"https://github.com/trending?l=ActionScript"},"Ada":{"color":"#02f88c","url":"https://github.com/trending?l=Ada"},"Adobe Font Metrics":{"color":"#fa0f00","url":"https://github.com/trending?l=Adobe-Font-Metrics"},"Agda":{"color":"#315665","url":"https://github.com/trending?l=Agda"},"AGS Script":{"color":"#B9D9FF","url":"https://github.com/trending?l=AGS-Script"},"AIDL":{"color":"#34EB6B","url":"https://github.com/trending?l=AIDL"},"AL":{"color":"#3AA2B5","url":"https://github.com/trending?l=AL"},"Alloy":{"color":"#64C800","url":"https://github.com/trending?l=Alloy"},"Alpine Abuild":{"color":"#0D597F","url":"https://github.com/trending?l=Alpine-Abuild"},"Altium Designer":{"color":"#A89663","url":"https://github.com/trending?l=Altium-Designer"},"AMPL":{"color":"#E6EFBB","url":"https://github.com/trending?l=AMPL"},"AngelScript":{"color":"#C7D7DC","url":"https://github.com/trending?l=AngelScript"},"Ant Build System":{"color":"#A9157E","url":"https://github.com/trending?l=Ant-Build-System"},"ANTLR":{"color":"#9DC3FF","url":"https://github.com/trending?l=ANTLR"},"ApacheConf":{"color":"#d12127","url":"https://github.com/trending?l=ApacheConf"},"Apex":{"color":"#1797c0","url":"https://github.com/trending?l=Apex"},"API Blueprint":{"color":"#2ACCA8","url":"https://github.com/trending?l=API-Blueprint"},"APL":{"color":"#5A8164","url":"https://github.com/trending?l=APL"},"Apollo Guidance Computer":{"color":"#0B3D91","url":"https://github.com/trending?l=Apollo-Guidance-Computer"},"AppleScript":{"color":"#101F1F","url":"https://github.com/trending?l=AppleScript"},"Arc":{"color":"#aa2afe","url":"https://github.com/trending?l=Arc"},"AsciiDoc":{"color":"#73a0c5","url":"https://github.com/trending?l=AsciiDoc"},"ASL":{"color":null,"url":"https://github.com/trending?l=ASL"},"ASP.NET":{"color":"#9400ff","url":"https://github.com/trending?l=ASP.NET"},"AspectJ":{"color":"#a957b0","url":"https://github.com/trending?l=AspectJ"},"Assembly":{"color":"#6E4C13","url":"https://github.com/trending?l=Assembly"},"Astro":{"color":"#ff5a03","url":"https://github.com/trending?l=Astro"},"Asymptote":{"color":"#ff0000","url":"https://github.com/trending?l=Asymptote"},"ATS":{"color":"#1ac620","url":"https://github.com/trending?l=ATS"},"Augeas":{"color":"#9CC134","url":"https://github.com/trending?l=Augeas"},"AutoHotkey":{"color":"#6594b9","url":"https://github.com/trending?l=AutoHotkey"},"AutoIt":{"color":"#1C3552","url":"https://github.com/trending?l=AutoIt"},"Avro IDL":{"color":"#0040FF","url":"https://github.com/trending?l=Avro-IDL"},"Awk":{"color":"#c30e9b","url":"https://github.com/trending?l=Awk"},"Ballerina":{"color":"#FF5000","url":"https://github.com/trending?l=Ballerina"},"BASIC":{"color":"#ff0000","url":"https://github.com/trending?l=BASIC"},"Batchfile":{"color":"#C1F12E","url":"https://github.com/trending?l=Batchfile"},"Beef":{"color":"#a52f4e","url":"https://github.com/trending?l=Beef"},"Befunge":{"color":null,"url":"https://github.com/trending?l=Befunge"},"Berry":{"color":"#15A13C","url":"https://github.com/trending?l=Berry"},"BibTeX":{"color":"#778899","url":"https://github.com/trending?l=BibTeX"},"Bicep":{"color":"#519aba","url":"https://github.com/trending?l=Bicep"},"Bison":{"color":"#6A463F","url":"https://github.com/trending?l=Bison"},"BitBake":{"color":"#00bce4","url":"https://github.com/trending?l=BitBake"},"Blade":{"color":"#f7523f","url":"https://github.com/trending?l=Blade"},"BlitzBasic":{"color":"#00FFAE","url":"https://github.com/trending?l=BlitzBasic"},"BlitzMax":{"color":"#cd6400","url":"https://github.com/trending?l=BlitzMax"},"Bluespec":{"color":"#12223c","url":"https://github.com/trending?l=Bluespec"},"Boo":{"color":"#d4bec1","url":"https://github.com/trending?l=Boo"},"Boogie":{"color":"#c80fa0","url":"https://github.com/trending?l=Boogie"},"Brainfuck":{"color":"#2F2530","url":"https://github.com/trending?l=Brainfuck"},"Brightscript":{"color":"#662D91","url":"https://github.com/trending?l=Brightscript"},"Browserslist":{"color":"#ffd539","url":"https://github.com/trending?l=Browserslist"},"C":{"color":"#555555","url":"https://github.com/trending?l=C"},"C#":{"color":"#178600","url":"https://github.com/trending?l=Csharp"},"C++":{"color":"#f34b7d","url":"https://github.com/trending?l=C++"},"C2hs Haskell":{"color":null,"url":"https://github.com/trending?l=C2hs-Haskell"},"Cabal Config":{"color":"#483465","url":"https://github.com/trending?l=Cabal-Config"},"Cadence":{"color":"#00ef8b","url":"https://github.com/trending?l=Cadence"},"Cairo":{"color":"#ff4a48","url":"https://github.com/trending?l=Cairo"},"CameLIGO":{"color":"#3be133","url":"https://github.com/trending?l=CameLIGO"},"CAP CDS":{"color":"#0092d1","url":"https://github.com/trending?l=CAP-CDS"},"Cap'n Proto":{"color":"#c42727","url":"https://github.com/trending?l=Cap'n-Proto"},"CartoCSS":{"color":null,"url":"https://github.com/trending?l=CartoCSS"},"Ceylon":{"color":"#dfa535","url":"https://github.com/trending?l=Ceylon"},"Chapel":{"color":"#8dc63f","url":"https://github.com/trending?l=Chapel"},"Charity":{"color":null,"url":"https://github.com/trending?l=Charity"},"ChucK":{"color":"#3f8000","url":"https://github.com/trending?l=ChucK"},"Cirru":{"color":"#ccccff","url":"https://github.com/trending?l=Cirru"},"Clarion":{"color":"#db901e","url":"https://github.com/trending?l=Clarion"},"Clarity":{"color":"#5546ff","url":"https://github.com/trending?l=Clarity"},"Classic ASP":{"color":"#6a40fd","url":"https://github.com/trending?l=Classic-ASP"},"Clean":{"color":"#3F85AF","url":"https://github.com/trending?l=Clean"},"Click":{"color":"#E4E6F3","url":"https://github.com/trending?l=Click"},"CLIPS":{"color":"#00A300","url":"https://github.com/trending?l=CLIPS"},"Clojure":{"color":"#db5855","url":"https://github.com/trending?l=Clojure"},"Closure Templates":{"color":"#0d948f","url":"https://github.com/trending?l=Closure-Templates"},"Cloud Firestore Security Rules":{"color":"#FFA000","url":"https://github.com/trending?l=Cloud-Firestore-Security-Rules"},"CMake":{"color":"#DA3434","url":"https://github.com/trending?l=CMake"},"COBOL":{"color":null,"url":"https://github.com/trending?l=COBOL"},"CodeQL":{"color":"#140f46","url":"https://github.com/trending?l=CodeQL"},"CoffeeScript":{"color":"#244776","url":"https://github.com/trending?l=CoffeeScript"},"ColdFusion":{"color":"#ed2cd6","url":"https://github.com/trending?l=ColdFusion"},"ColdFusion CFC":{"color":"#ed2cd6","url":"https://github.com/trending?l=ColdFusion-CFC"},"COLLADA":{"color":"#F1A42B","url":"https://github.com/trending?l=COLLADA"},"Common Lisp":{"color":"#3fb68b","url":"https://github.com/trending?l=Common-Lisp"},"Common Workflow Language":{"color":"#B5314C","url":"https://github.com/trending?l=Common-Workflow-Language"},"Component Pascal":{"color":"#B0CE4E","url":"https://github.com/trending?l=Component-Pascal"},"Cool":{"color":null,"url":"https://github.com/trending?l=Cool"},"Coq":{"color":"#d0b68c","url":"https://github.com/trending?l=Coq"},"Crystal":{"color":"#000100","url":"https://github.com/trending?l=Crystal"},"CSON":{"color":"#244776","url":"https://github.com/trending?l=CSON"},"Csound":{"color":"#1a1a1a","url":"https://github.com/trending?l=Csound"},"Csound Document":{"color":"#1a1a1a","url":"https://github.com/trending?l=Csound-Document"},"Csound Score":{"color":"#1a1a1a","url":"https://github.com/trending?l=Csound-Score"},"CSS":{"color":"#563d7c","url":"https://github.com/trending?l=CSS"},"CSV":{"color":"#237346","url":"https://github.com/trending?l=CSV"},"Cuda":{"color":"#3A4E3A","url":"https://github.com/trending?l=Cuda"},"CUE":{"color":"#5886E1","url":"https://github.com/trending?l=CUE"},"Curry":{"color":"#531242","url":"https://github.com/trending?l=Curry"},"CWeb":{"color":"#00007a","url":"https://github.com/trending?l=CWeb"},"Cycript":{"color":null,"url":"https://github.com/trending?l=Cycript"},"Cython":{"color":"#fedf5b","url":"https://github.com/trending?l=Cython"},"D":{"color":"#ba595e","url":"https://github.com/trending?l=D"},"Dafny":{"color":"#FFEC25","url":"https://github.com/trending?l=Dafny"},"Darcs Patch":{"color":"#8eff23","url":"https://github.com/trending?l=Darcs-Patch"},"Dart":{"color":"#00B4AB","url":"https://github.com/trending?l=Dart"},"DataWeave":{"color":"#003a52","url":"https://github.com/trending?l=DataWeave"},"Debian Package Control File":{"color":"#D70751","url":"https://github.com/trending?l=Debian-Package-Control-File"},"DenizenScript":{"color":"#FBEE96","url":"https://github.com/trending?l=DenizenScript"},"Dhall":{"color":"#dfafff","url":"https://github.com/trending?l=Dhall"},"DIGITAL Command Language":{"color":null,"url":"https://github.com/trending?l=DIGITAL-Command-Language"},"DirectX 3D File":{"color":"#aace60","url":"https://github.com/trending?l=DirectX-3D-File"},"DM":{"color":"#447265","url":"https://github.com/trending?l=DM"},"Dockerfile":{"color":"#384d54","url":"https://github.com/trending?l=Dockerfile"},"Dogescript":{"color":"#cca760","url":"https://github.com/trending?l=Dogescript"},"DTrace":{"color":null,"url":"https://github.com/trending?l=DTrace"},"Dylan":{"color":"#6c616e","url":"https://github.com/trending?l=Dylan"},"E":{"color":"#ccce35","url":"https://github.com/trending?l=E"},"Earthly":{"color":"#2af0ff","url":"https://github.com/trending?l=Earthly"},"Easybuild":{"color":"#069406","url":"https://github.com/trending?l=Easybuild"},"eC":{"color":"#913960","url":"https://github.com/trending?l=eC"},"Ecere Projects":{"color":"#913960","url":"https://github.com/trending?l=Ecere-Projects"},"ECL":{"color":"#8a1267","url":"https://github.com/trending?l=ECL"},"ECLiPSe":{"color":"#001d9d","url":"https://github.com/trending?l=ECLiPSe"},"EditorConfig":{"color":"#fff1f2","url":"https://github.com/trending?l=EditorConfig"},"Eiffel":{"color":"#4d6977","url":"https://github.com/trending?l=Eiffel"},"EJS":{"color":"#a91e50","url":"https://github.com/trending?l=EJS"},"Elixir":{"color":"#6e4a7e","url":"https://github.com/trending?l=Elixir"},"Elm":{"color":"#60B5CC","url":"https://github.com/trending?l=Elm"},"Emacs Lisp":{"color":"#c065db","url":"https://github.com/trending?l=Emacs-Lisp"},"EmberScript":{"color":"#FFF4F3","url":"https://github.com/trending?l=EmberScript"},"EQ":{"color":"#a78649","url":"https://github.com/trending?l=EQ"},"Erlang":{"color":"#B83998","url":"https://github.com/trending?l=Erlang"},"Euphoria":{"color":"#FF790B","url":"https://github.com/trending?l=Euphoria"},"F#":{"color":"#b845fc","url":"https://github.com/trending?l=Fsharp"},"F*":{"color":"#572e30","url":"https://github.com/trending?l=F*"},"Factor":{"color":"#636746","url":"https://github.com/trending?l=Factor"},"Fancy":{"color":"#7b9db4","url":"https://github.com/trending?l=Fancy"},"Fantom":{"color":"#14253c","url":"https://github.com/trending?l=Fantom"},"Faust":{"color":"#c37240","url":"https://github.com/trending?l=Faust"},"Fennel":{"color":"#fff3d7","url":"https://github.com/trending?l=Fennel"},"FIGlet Font":{"color":"#FFDDBB","url":"https://github.com/trending?l=FIGlet-Font"},"Filebench WML":{"color":"#F6B900","url":"https://github.com/trending?l=Filebench-WML"},"Filterscript":{"color":null,"url":"https://github.com/trending?l=Filterscript"},"fish":{"color":"#4aae47","url":"https://github.com/trending?l=fish"},"Fluent":{"color":"#ffcc33","url":"https://github.com/trending?l=Fluent"},"FLUX":{"color":"#88ccff","url":"https://github.com/trending?l=FLUX"},"Forth":{"color":"#341708","url":"https://github.com/trending?l=Forth"},"Fortran":{"color":"#4d41b1","url":"https://github.com/trending?l=Fortran"},"Fortran Free Form":{"color":"#4d41b1","url":"https://github.com/trending?l=Fortran-Free-Form"},"FreeBasic":{"color":"#867db1","url":"https://github.com/trending?l=FreeBasic"},"FreeMarker":{"color":"#0050b2","url":"https://github.com/trending?l=FreeMarker"},"Frege":{"color":"#00cafe","url":"https://github.com/trending?l=Frege"},"Futhark":{"color":"#5f021f","url":"https://github.com/trending?l=Futhark"},"G-code":{"color":"#D08CF2","url":"https://github.com/trending?l=G-code"},"Game Maker Language":{"color":"#71b417","url":"https://github.com/trending?l=Game-Maker-Language"},"GAML":{"color":"#FFC766","url":"https://github.com/trending?l=GAML"},"GAMS":{"color":"#f49a22","url":"https://github.com/trending?l=GAMS"},"GAP":{"color":"#0000cc","url":"https://github.com/trending?l=GAP"},"GCC Machine Description":{"color":"#FFCFAB","url":"https://github.com/trending?l=GCC-Machine-Description"},"GDB":{"color":null,"url":"https://github.com/trending?l=GDB"},"GDScript":{"color":"#355570","url":"https://github.com/trending?l=GDScript"},"GEDCOM":{"color":"#003058","url":"https://github.com/trending?l=GEDCOM"},"Gemfile.lock":{"color":"#701516","url":"https://github.com/trending?l=Gemfile.lock"},"Genero":{"color":"#63408e","url":"https://github.com/trending?l=Genero"},"Genero Forms":{"color":"#d8df39","url":"https://github.com/trending?l=Genero-Forms"},"Genie":{"color":"#fb855d","url":"https://github.com/trending?l=Genie"},"Genshi":{"color":"#951531","url":"https://github.com/trending?l=Genshi"},"Gentoo Ebuild":{"color":"#9400ff","url":"https://github.com/trending?l=Gentoo-Ebuild"},"Gentoo Eclass":{"color":"#9400ff","url":"https://github.com/trending?l=Gentoo-Eclass"},"Gerber Image":{"color":"#d20b00","url":"https://github.com/trending?l=Gerber-Image"},"Gherkin":{"color":"#5B2063","url":"https://github.com/trending?l=Gherkin"},"Git Attributes":{"color":"#F44D27","url":"https://github.com/trending?l=Git-Attributes"},"Git Config":{"color":"#F44D27","url":"https://github.com/trending?l=Git-Config"},"Gleam":{"color":"#ffaff3","url":"https://github.com/trending?l=Gleam"},"GLSL":{"color":"#5686a5","url":"https://github.com/trending?l=GLSL"},"Glyph":{"color":"#c1ac7f","url":"https://github.com/trending?l=Glyph"},"Gnuplot":{"color":"#f0a9f0","url":"https://github.com/trending?l=Gnuplot"},"Go":{"color":"#00ADD8","url":"https://github.com/trending?l=Go"},"Go Checksums":{"color":"#00ADD8","url":"https://github.com/trending?l=Go-Checksums"},"Go Module":{"color":"#00ADD8","url":"https://github.com/trending?l=Go-Module"},"Golo":{"color":"#88562A","url":"https://github.com/trending?l=Golo"},"Gosu":{"color":"#82937f","url":"https://github.com/trending?l=Gosu"},"Grace":{"color":"#615f8b","url":"https://github.com/trending?l=Grace"},"Gradle":{"color":"#02303a","url":"https://github.com/trending?l=Gradle"},"Grammatical Framework":{"color":"#ff0000","url":"https://github.com/trending?l=Grammatical-Framework"},"GraphQL":{"color":"#e10098","url":"https://github.com/trending?l=GraphQL"},"Graphviz (DOT)":{"color":"#2596be","url":"https://github.com/trending?l=Graphviz-(DOT)"},"Groovy":{"color":"#4298b8","url":"https://github.com/trending?l=Groovy"},"Groovy Server Pages":{"color":"#4298b8","url":"https://github.com/trending?l=Groovy-Server-Pages"},"GSC":{"color":"#FF6800","url":"https://github.com/trending?l=GSC"},"Hack":{"color":"#878787","url":"https://github.com/trending?l=Hack"},"Haml":{"color":"#ece2a9","url":"https://github.com/trending?l=Haml"},"Handlebars":{"color":"#f7931e","url":"https://github.com/trending?l=Handlebars"},"HAProxy":{"color":"#106da9","url":"https://github.com/trending?l=HAProxy"},"Harbour":{"color":"#0e60e3","url":"https://github.com/trending?l=Harbour"},"Haskell":{"color":"#5e5086","url":"https://github.com/trending?l=Haskell"},"Haxe":{"color":"#df7900","url":"https://github.com/trending?l=Haxe"},"HCL":{"color":null,"url":"https://github.com/trending?l=HCL"},"HiveQL":{"color":"#dce200","url":"https://github.com/trending?l=HiveQL"},"HLSL":{"color":"#aace60","url":"https://github.com/trending?l=HLSL"},"HolyC":{"color":"#ffefaf","url":"https://github.com/trending?l=HolyC"},"hoon":{"color":"#00b171","url":"https://github.com/trending?l=hoon"},"HTML":{"color":"#e34c26","url":"https://github.com/trending?l=HTML"},"HTML+ECR":{"color":"#2e1052","url":"https://github.com/trending?l=HTML+ECR"},"HTML+EEX":{"color":"#6e4a7e","url":"https://github.com/trending?l=HTML+EEX"},"HTML+ERB":{"color":"#701516","url":"https://github.com/trending?l=HTML+ERB"},"HTML+PHP":{"color":"#4f5d95","url":"https://github.com/trending?l=HTML+PHP"},"HTML+Razor":{"color":"#512be4","url":"https://github.com/trending?l=HTML+Razor"},"HTTP":{"color":"#005C9C","url":"https://github.com/trending?l=HTTP"},"HXML":{"color":"#f68712","url":"https://github.com/trending?l=HXML"},"Hy":{"color":"#7790B2","url":"https://github.com/trending?l=Hy"},"HyPhy":{"color":null,"url":"https://github.com/trending?l=HyPhy"},"IDL":{"color":"#a3522f","url":"https://github.com/trending?l=IDL"},"Idris":{"color":"#b30000","url":"https://github.com/trending?l=Idris"},"Ignore List":{"color":"#000000","url":"https://github.com/trending?l=Ignore-List"},"IGOR Pro":{"color":"#0000cc","url":"https://github.com/trending?l=IGOR-Pro"},"ImageJ Macro":{"color":"#99AAFF","url":"https://github.com/trending?l=ImageJ-Macro"},"Inform 7":{"color":null,"url":"https://github.com/trending?l=Inform-7"},"INI":{"color":"#d1dbe0","url":"https://github.com/trending?l=INI"},"Inno Setup":{"color":"#264b99","url":"https://github.com/trending?l=Inno-Setup"},"Io":{"color":"#a9188d","url":"https://github.com/trending?l=Io"},"Ioke":{"color":"#078193","url":"https://github.com/trending?l=Ioke"},"Isabelle":{"color":"#FEFE00","url":"https://github.com/trending?l=Isabelle"},"Isabelle ROOT":{"color":"#FEFE00","url":"https://github.com/trending?l=Isabelle-ROOT"},"J":{"color":"#9EEDFF","url":"https://github.com/trending?l=J"},"Janet":{"color":"#0886a5","url":"https://github.com/trending?l=Janet"},"JAR Manifest":{"color":"#b07219","url":"https://github.com/trending?l=JAR-Manifest"},"Jasmin":{"color":"#d03600","url":"https://github.com/trending?l=Jasmin"},"Java":{"color":"#b07219","url":"https://github.com/trending?l=Java"},"Java Properties":{"color":"#2A6277","url":"https://github.com/trending?l=Java-Properties"},"Java Server Pages":{"color":"#2A6277","url":"https://github.com/trending?l=Java-Server-Pages"},"JavaScript":{"color":"#f1e05a","url":"https://github.com/trending?l=JavaScript"},"JavaScript+ERB":{"color":"#f1e05a","url":"https://github.com/trending?l=JavaScript+ERB"},"Jest Snapshot":{"color":"#15c213","url":"https://github.com/trending?l=Jest-Snapshot"},"JetBrains MPS":{"color":"#21D789","url":"https://github.com/trending?l=JetBrains-MPS"},"JFlex":{"color":"#DBCA00","url":"https://github.com/trending?l=JFlex"},"Jinja":{"color":"#a52a22","url":"https://github.com/trending?l=Jinja"},"Jison":{"color":"#56b3cb","url":"https://github.com/trending?l=Jison"},"Jison Lex":{"color":"#56b3cb","url":"https://github.com/trending?l=Jison-Lex"},"Jolie":{"color":"#843179","url":"https://github.com/trending?l=Jolie"},"jq":{"color":"#c7254e","url":"https://github.com/trending?l=jq"},"JSON":{"color":"#292929","url":"https://github.com/trending?l=JSON"},"JSON with Comments":{"color":"#292929","url":"https://github.com/trending?l=JSON-with-Comments"},"JSON5":{"color":"#267CB9","url":"https://github.com/trending?l=JSON5"},"JSONiq":{"color":"#40d47e","url":"https://github.com/trending?l=JSONiq"},"JSONLD":{"color":"#0c479c","url":"https://github.com/trending?l=JSONLD"},"Jsonnet":{"color":"#0064bd","url":"https://github.com/trending?l=Jsonnet"},"Julia":{"color":"#a270ba","url":"https://github.com/trending?l=Julia"},"Jupyter Notebook":{"color":"#DA5B0B","url":"https://github.com/trending?l=Jupyter-Notebook"},"Kaitai Struct":{"color":"#773b37","url":"https://github.com/trending?l=Kaitai-Struct"},"KakouneScript":{"color":"#6f8042","url":"https://github.com/trending?l=KakouneScript"},"KiCad Layout":{"color":"#2f4aab","url":"https://github.com/trending?l=KiCad-Layout"},"KiCad Legacy Layout":{"color":"#2f4aab","url":"https://github.com/trending?l=KiCad-Legacy-Layout"},"KiCad Schematic":{"color":"#2f4aab","url":"https://github.com/trending?l=KiCad-Schematic"},"Kotlin":{"color":"#A97BFF","url":"https://github.com/trending?l=Kotlin"},"KRL":{"color":"#28430A","url":"https://github.com/trending?l=KRL"},"kvlang":{"color":"#1da6e0","url":"https://github.com/trending?l=kvlang"},"LabVIEW":{"color":"#fede06","url":"https://github.com/trending?l=LabVIEW"},"Lark":{"color":"#2980B9","url":"https://github.com/trending?l=Lark"},"Lasso":{"color":"#999999","url":"https://github.com/trending?l=Lasso"},"Latte":{"color":"#f2a542","url":"https://github.com/trending?l=Latte"},"Lean":{"color":null,"url":"https://github.com/trending?l=Lean"},"Less":{"color":"#1d365d","url":"https://github.com/trending?l=Less"},"Lex":{"color":"#DBCA00","url":"https://github.com/trending?l=Lex"},"LFE":{"color":"#4C3023","url":"https://github.com/trending?l=LFE"},"LigoLANG":{"color":"#0e74ff","url":"https://github.com/trending?l=LigoLANG"},"LilyPond":{"color":"#9ccc7c","url":"https://github.com/trending?l=LilyPond"},"Limbo":{"color":null,"url":"https://github.com/trending?l=Limbo"},"Liquid":{"color":"#67b8de","url":"https://github.com/trending?l=Liquid"},"Literate Agda":{"color":"#315665","url":"https://github.com/trending?l=Literate-Agda"},"Literate CoffeeScript":{"color":"#244776","url":"https://github.com/trending?l=Literate-CoffeeScript"},"Literate Haskell":{"color":"#5e5086","url":"https://github.com/trending?l=Literate-Haskell"},"LiveScript":{"color":"#499886","url":"https://github.com/trending?l=LiveScript"},"LLVM":{"color":"#185619","url":"https://github.com/trending?l=LLVM"},"Logos":{"color":null,"url":"https://github.com/trending?l=Logos"},"Logtalk":{"color":"#295b9a","url":"https://github.com/trending?l=Logtalk"},"LOLCODE":{"color":"#cc9900","url":"https://github.com/trending?l=LOLCODE"},"LookML":{"color":"#652B81","url":"https://github.com/trending?l=LookML"},"LoomScript":{"color":null,"url":"https://github.com/trending?l=LoomScript"},"LSL":{"color":"#3d9970","url":"https://github.com/trending?l=LSL"},"Lua":{"color":"#000080","url":"https://github.com/trending?l=Lua"},"M":{"color":null,"url":"https://github.com/trending?l=M"},"M4":{"color":null,"url":"https://github.com/trending?l=M4"},"M4Sugar":{"color":null,"url":"https://github.com/trending?l=M4Sugar"},"Macaulay2":{"color":"#d8ffff","url":"https://github.com/trending?l=Macaulay2"},"Makefile":{"color":"#427819","url":"https://github.com/trending?l=Makefile"},"Mako":{"color":"#7e858d","url":"https://github.com/trending?l=Mako"},"Markdown":{"color":"#083fa1","url":"https://github.com/trending?l=Markdown"},"Marko":{"color":"#42bff2","url":"https://github.com/trending?l=Marko"},"Mask":{"color":"#f97732","url":"https://github.com/trending?l=Mask"},"Mathematica":{"color":"#dd1100","url":"https://github.com/trending?l=Mathematica"},"MATLAB":{"color":"#e16737","url":"https://github.com/trending?l=MATLAB"},"Max":{"color":"#c4a79c","url":"https://github.com/trending?l=Max"},"MAXScript":{"color":"#00a6a6","url":"https://github.com/trending?l=MAXScript"},"mcfunction":{"color":"#E22837","url":"https://github.com/trending?l=mcfunction"},"Mercury":{"color":"#ff2b2b","url":"https://github.com/trending?l=Mercury"},"Meson":{"color":"#007800","url":"https://github.com/trending?l=Meson"},"Metal":{"color":"#8f14e9","url":"https://github.com/trending?l=Metal"},"MiniD":{"color":null,"url":"https://github.com/trending?l=MiniD"},"MiniYAML":{"color":"#ff1111","url":"https://github.com/trending?l=MiniYAML"},"Mint":{"color":"#02b046","url":"https://github.com/trending?l=Mint"},"Mirah":{"color":"#c7a938","url":"https://github.com/trending?l=Mirah"},"mIRC Script":{"color":"#3d57c3","url":"https://github.com/trending?l=mIRC-Script"},"MLIR":{"color":"#5EC8DB","url":"https://github.com/trending?l=MLIR"},"Modelica":{"color":"#de1d31","url":"https://github.com/trending?l=Modelica"},"Modula-2":{"color":"#10253f","url":"https://github.com/trending?l=Modula-2"},"Modula-3":{"color":"#223388","url":"https://github.com/trending?l=Modula-3"},"Module Management System":{"color":null,"url":"https://github.com/trending?l=Module-Management-System"},"Monkey":{"color":null,"url":"https://github.com/trending?l=Monkey"},"Monkey C":{"color":"#8D6747","url":"https://github.com/trending?l=Monkey-C"},"Moocode":{"color":null,"url":"https://github.com/trending?l=Moocode"},"MoonScript":{"color":"#ff4585","url":"https://github.com/trending?l=MoonScript"},"Motoko":{"color":"#fbb03b","url":"https://github.com/trending?l=Motoko"},"Motorola 68K Assembly":{"color":"#005daa","url":"https://github.com/trending?l=Motorola-68K-Assembly"},"MQL4":{"color":"#62A8D6","url":"https://github.com/trending?l=MQL4"},"MQL5":{"color":"#4A76B8","url":"https://github.com/trending?l=MQL5"},"MTML":{"color":"#b7e1f4","url":"https://github.com/trending?l=MTML"},"MUF":{"color":null,"url":"https://github.com/trending?l=MUF"},"mupad":{"color":"#244963","url":"https://github.com/trending?l=mupad"},"Mustache":{"color":"#724b3b","url":"https://github.com/trending?l=Mustache"},"Myghty":{"color":null,"url":"https://github.com/trending?l=Myghty"},"nanorc":{"color":"#2d004d","url":"https://github.com/trending?l=nanorc"},"NASL":{"color":null,"url":"https://github.com/trending?l=NASL"},"NCL":{"color":"#28431f","url":"https://github.com/trending?l=NCL"},"Nearley":{"color":"#990000","url":"https://github.com/trending?l=Nearley"},"Nemerle":{"color":"#3d3c6e","url":"https://github.com/trending?l=Nemerle"},"nesC":{"color":"#94B0C7","url":"https://github.com/trending?l=nesC"},"NetLinx":{"color":"#0aa0ff","url":"https://github.com/trending?l=NetLinx"},"NetLinx+ERB":{"color":"#747faa","url":"https://github.com/trending?l=NetLinx+ERB"},"NetLogo":{"color":"#ff6375","url":"https://github.com/trending?l=NetLogo"},"NewLisp":{"color":"#87AED7","url":"https://github.com/trending?l=NewLisp"},"Nextflow":{"color":"#3ac486","url":"https://github.com/trending?l=Nextflow"},"Nginx":{"color":"#009639","url":"https://github.com/trending?l=Nginx"},"Nim":{"color":"#ffc200","url":"https://github.com/trending?l=Nim"},"Nit":{"color":"#009917","url":"https://github.com/trending?l=Nit"},"Nix":{"color":"#7e7eff","url":"https://github.com/trending?l=Nix"},"NPM Config":{"color":"#cb3837","url":"https://github.com/trending?l=NPM-Config"},"NSIS":{"color":null,"url":"https://github.com/trending?l=NSIS"},"Nu":{"color":"#c9df40","url":"https://github.com/trending?l=Nu"},"NumPy":{"color":"#9C8AF9","url":"https://github.com/trending?l=NumPy"},"Nunjucks":{"color":"#3d8137","url":"https://github.com/trending?l=Nunjucks"},"NWScript":{"color":"#111522","url":"https://github.com/trending?l=NWScript"},"Objective-C":{"color":"#438eff","url":"https://github.com/trending?l=Objective-C"},"Objective-C++":{"color":"#6866fb","url":"https://github.com/trending?l=Objective-C++"},"Objective-J":{"color":"#ff0c5a","url":"https://github.com/trending?l=Objective-J"},"ObjectScript":{"color":"#424893","url":"https://github.com/trending?l=ObjectScript"},"OCaml":{"color":"#3be133","url":"https://github.com/trending?l=OCaml"},"Odin":{"color":"#60AFFE","url":"https://github.com/trending?l=Odin"},"Omgrofl":{"color":"#cabbff","url":"https://github.com/trending?l=Omgrofl"},"ooc":{"color":"#b0b77e","url":"https://github.com/trending?l=ooc"},"Opa":{"color":null,"url":"https://github.com/trending?l=Opa"},"Opal":{"color":"#f7ede0","url":"https://github.com/trending?l=Opal"},"Open Policy Agent":{"color":"#7d9199","url":"https://github.com/trending?l=Open-Policy-Agent"},"OpenCL":{"color":"#ed2e2d","url":"https://github.com/trending?l=OpenCL"},"OpenEdge ABL":{"color":"#5ce600","url":"https://github.com/trending?l=OpenEdge-ABL"},"OpenQASM":{"color":"#AA70FF","url":"https://github.com/trending?l=OpenQASM"},"OpenRC runscript":{"color":null,"url":"https://github.com/trending?l=OpenRC-runscript"},"OpenSCAD":{"color":"#e5cd45","url":"https://github.com/trending?l=OpenSCAD"},"Org":{"color":"#77aa99","url":"https://github.com/trending?l=Org"},"Ox":{"color":null,"url":"https://github.com/trending?l=Ox"},"Oxygene":{"color":"#cdd0e3","url":"https://github.com/trending?l=Oxygene"},"Oz":{"color":"#fab738","url":"https://github.com/trending?l=Oz"},"P4":{"color":"#7055b5","url":"https://github.com/trending?l=P4"},"Pan":{"color":"#cc0000","url":"https://github.com/trending?l=Pan"},"Papyrus":{"color":"#6600cc","url":"https://github.com/trending?l=Papyrus"},"Parrot":{"color":"#f3ca0a","url":"https://github.com/trending?l=Parrot"},"Parrot Assembly":{"color":null,"url":"https://github.com/trending?l=Parrot-Assembly"},"Parrot Internal Representation":{"color":null,"url":"https://github.com/trending?l=Parrot-Internal-Representation"},"Pascal":{"color":"#E3F171","url":"https://github.com/trending?l=Pascal"},"Pawn":{"color":"#dbb284","url":"https://github.com/trending?l=Pawn"},"PEG.js":{"color":"#234d6b","url":"https://github.com/trending?l=PEG.js"},"Pep8":{"color":"#C76F5B","url":"https://github.com/trending?l=Pep8"},"Perl":{"color":"#0298c3","url":"https://github.com/trending?l=Perl"},"PHP":{"color":"#4F5D95","url":"https://github.com/trending?l=PHP"},"PicoLisp":{"color":"#6067af","url":"https://github.com/trending?l=PicoLisp"},"PigLatin":{"color":"#fcd7de","url":"https://github.com/trending?l=PigLatin"},"Pike":{"color":"#005390","url":"https://github.com/trending?l=Pike"},"PLpgSQL":{"color":"#336790","url":"https://github.com/trending?l=PLpgSQL"},"PLSQL":{"color":"#dad8d8","url":"https://github.com/trending?l=PLSQL"},"PogoScript":{"color":"#d80074","url":"https://github.com/trending?l=PogoScript"},"Pony":{"color":null,"url":"https://github.com/trending?l=Pony"},"Portugol":{"color":"#f8bd00","url":"https://github.com/trending?l=Portugol"},"PostCSS":{"color":"#dc3a0c","url":"https://github.com/trending?l=PostCSS"},"PostScript":{"color":"#da291c","url":"https://github.com/trending?l=PostScript"},"POV-Ray SDL":{"color":"#6bac65","url":"https://github.com/trending?l=POV-Ray-SDL"},"PowerBuilder":{"color":"#8f0f8d","url":"https://github.com/trending?l=PowerBuilder"},"PowerShell":{"color":"#012456","url":"https://github.com/trending?l=PowerShell"},"Prisma":{"color":"#0c344b","url":"https://github.com/trending?l=Prisma"},"Processing":{"color":"#0096D8","url":"https://github.com/trending?l=Processing"},"Procfile":{"color":"#3B2F63","url":"https://github.com/trending?l=Procfile"},"Prolog":{"color":"#74283c","url":"https://github.com/trending?l=Prolog"},"Promela":{"color":"#de0000","url":"https://github.com/trending?l=Promela"},"Propeller Spin":{"color":"#7fa2a7","url":"https://github.com/trending?l=Propeller-Spin"},"Pug":{"color":"#a86454","url":"https://github.com/trending?l=Pug"},"Puppet":{"color":"#302B6D","url":"https://github.com/trending?l=Puppet"},"PureBasic":{"color":"#5a6986","url":"https://github.com/trending?l=PureBasic"},"PureScript":{"color":"#1D222D","url":"https://github.com/trending?l=PureScript"},"Python":{"color":"#3572A5","url":"https://github.com/trending?l=Python"},"Python console":{"color":"#3572A5","url":"https://github.com/trending?l=Python-console"},"Python traceback":{"color":"#3572A5","url":"https://github.com/trending?l=Python-traceback"},"q":{"color":"#0040cd","url":"https://github.com/trending?l=q"},"Q#":{"color":"#fed659","url":"https://github.com/trending?l=Qsharp"},"QMake":{"color":null,"url":"https://github.com/trending?l=QMake"},"QML":{"color":"#44a51c","url":"https://github.com/trending?l=QML"},"Qt Script":{"color":"#00b841","url":"https://github.com/trending?l=Qt-Script"},"Quake":{"color":"#882233","url":"https://github.com/trending?l=Quake"},"R":{"color":"#198CE7","url":"https://github.com/trending?l=R"},"Racket":{"color":"#3c5caa","url":"https://github.com/trending?l=Racket"},"Ragel":{"color":"#9d5200","url":"https://github.com/trending?l=Ragel"},"Raku":{"color":"#0000fb","url":"https://github.com/trending?l=Raku"},"RAML":{"color":"#77d9fb","url":"https://github.com/trending?l=RAML"},"Rascal":{"color":"#fffaa0","url":"https://github.com/trending?l=Rascal"},"RDoc":{"color":"#701516","url":"https://github.com/trending?l=RDoc"},"REALbasic":{"color":null,"url":"https://github.com/trending?l=REALbasic"},"Reason":{"color":"#ff5847","url":"https://github.com/trending?l=Reason"},"ReasonLIGO":{"color":"#ff5847","url":"https://github.com/trending?l=ReasonLIGO"},"Rebol":{"color":"#358a5b","url":"https://github.com/trending?l=Rebol"},"Record Jar":{"color":"#0673ba","url":"https://github.com/trending?l=Record-Jar"},"Red":{"color":"#f50000","url":"https://github.com/trending?l=Red"},"Redcode":{"color":null,"url":"https://github.com/trending?l=Redcode"},"Regular Expression":{"color":"#009a00","url":"https://github.com/trending?l=Regular-Expression"},"Ren'Py":{"color":"#ff7f7f","url":"https://github.com/trending?l=Ren'Py"},"RenderScript":{"color":null,"url":"https://github.com/trending?l=RenderScript"},"ReScript":{"color":"#ed5051","url":"https://github.com/trending?l=ReScript"},"reStructuredText":{"color":"#141414","url":"https://github.com/trending?l=reStructuredText"},"REXX":{"color":"#d90e09","url":"https://github.com/trending?l=REXX"},"Ring":{"color":"#2D54CB","url":"https://github.com/trending?l=Ring"},"Riot":{"color":"#A71E49","url":"https://github.com/trending?l=Riot"},"RMarkdown":{"color":"#198ce7","url":"https://github.com/trending?l=RMarkdown"},"RobotFramework":{"color":"#00c0b5","url":"https://github.com/trending?l=RobotFramework"},"Roff":{"color":"#ecdebe","url":"https://github.com/trending?l=Roff"},"Roff Manpage":{"color":"#ecdebe","url":"https://github.com/trending?l=Roff-Manpage"},"Rouge":{"color":"#cc0088","url":"https://github.com/trending?l=Rouge"},"RPC":{"color":null,"url":"https://github.com/trending?l=RPC"},"RPGLE":{"color":"#2BDE21","url":"https://github.com/trending?l=RPGLE"},"Ruby":{"color":"#701516","url":"https://github.com/trending?l=Ruby"},"RUNOFF":{"color":"#665a4e","url":"https://github.com/trending?l=RUNOFF"},"Rust":{"color":"#dea584","url":"https://github.com/trending?l=Rust"},"Sage":{"color":null,"url":"https://github.com/trending?l=Sage"},"SaltStack":{"color":"#646464","url":"https://github.com/trending?l=SaltStack"},"SAS":{"color":"#B34936","url":"https://github.com/trending?l=SAS"},"Sass":{"color":"#a53b70","url":"https://github.com/trending?l=Sass"},"Scala":{"color":"#c22d40","url":"https://github.com/trending?l=Scala"},"Scaml":{"color":"#bd181a","url":"https://github.com/trending?l=Scaml"},"Scheme":{"color":"#1e4aec","url":"https://github.com/trending?l=Scheme"},"Scilab":{"color":"#ca0f21","url":"https://github.com/trending?l=Scilab"},"SCSS":{"color":"#c6538c","url":"https://github.com/trending?l=SCSS"},"sed":{"color":"#64b970","url":"https://github.com/trending?l=sed"},"Self":{"color":"#0579aa","url":"https://github.com/trending?l=Self"},"ShaderLab":{"color":"#222c37","url":"https://github.com/trending?l=ShaderLab"},"Shell":{"color":"#89e051","url":"https://github.com/trending?l=Shell"},"ShellCheck Config":{"color":"#cecfcb","url":"https://github.com/trending?l=ShellCheck-Config"},"ShellSession":{"color":null,"url":"https://github.com/trending?l=ShellSession"},"Shen":{"color":"#120F14","url":"https://github.com/trending?l=Shen"},"Sieve":{"color":null,"url":"https://github.com/trending?l=Sieve"},"Singularity":{"color":"#64E6AD","url":"https://github.com/trending?l=Singularity"},"Slash":{"color":"#007eff","url":"https://github.com/trending?l=Slash"},"Slice":{"color":"#003fa2","url":"https://github.com/trending?l=Slice"},"Slim":{"color":"#2b2b2b","url":"https://github.com/trending?l=Slim"},"Smali":{"color":null,"url":"https://github.com/trending?l=Smali"},"Smalltalk":{"color":"#596706","url":"https://github.com/trending?l=Smalltalk"},"Smarty":{"color":"#f0c040","url":"https://github.com/trending?l=Smarty"},"SmPL":{"color":"#c94949","url":"https://github.com/trending?l=SmPL"},"SMT":{"color":null,"url":"https://github.com/trending?l=SMT"},"Solidity":{"color":"#AA6746","url":"https://github.com/trending?l=Solidity"},"SourcePawn":{"color":"#f69e1d","url":"https://github.com/trending?l=SourcePawn"},"SPARQL":{"color":"#0C4597","url":"https://github.com/trending?l=SPARQL"},"SQF":{"color":"#3F3F3F","url":"https://github.com/trending?l=SQF"},"SQL":{"color":"#e38c00","url":"https://github.com/trending?l=SQL"},"SQLPL":{"color":"#e38c00","url":"https://github.com/trending?l=SQLPL"},"Squirrel":{"color":"#800000","url":"https://github.com/trending?l=Squirrel"},"SRecode Template":{"color":"#348a34","url":"https://github.com/trending?l=SRecode-Template"},"Stan":{"color":"#b2011d","url":"https://github.com/trending?l=Stan"},"Standard ML":{"color":"#dc566d","url":"https://github.com/trending?l=Standard-ML"},"Starlark":{"color":"#76d275","url":"https://github.com/trending?l=Starlark"},"Stata":{"color":"#1a5f91","url":"https://github.com/trending?l=Stata"},"STL":{"color":"#373b5e","url":"https://github.com/trending?l=STL"},"StringTemplate":{"color":"#3fb34f","url":"https://github.com/trending?l=StringTemplate"},"Stylus":{"color":"#ff6347","url":"https://github.com/trending?l=Stylus"},"SubRip Text":{"color":"#9e0101","url":"https://github.com/trending?l=SubRip-Text"},"SugarSS":{"color":"#2fcc9f","url":"https://github.com/trending?l=SugarSS"},"SuperCollider":{"color":"#46390b","url":"https://github.com/trending?l=SuperCollider"},"Svelte":{"color":"#ff3e00","url":"https://github.com/trending?l=Svelte"},"SVG":{"color":"#ff9900","url":"https://github.com/trending?l=SVG"},"Swift":{"color":"#F05138","url":"https://github.com/trending?l=Swift"},"SWIG":{"color":null,"url":"https://github.com/trending?l=SWIG"},"SystemVerilog":{"color":"#DAE1C2","url":"https://github.com/trending?l=SystemVerilog"},"Talon":{"color":"#333333","url":"https://github.com/trending?l=Talon"},"Tcl":{"color":"#e4cc98","url":"https://github.com/trending?l=Tcl"},"Tcsh":{"color":null,"url":"https://github.com/trending?l=Tcsh"},"Terra":{"color":"#00004c","url":"https://github.com/trending?l=Terra"},"TeX":{"color":"#3D6117","url":"https://github.com/trending?l=TeX"},"Textile":{"color":"#ffe7ac","url":"https://github.com/trending?l=Textile"},"TextMate Properties":{"color":"#df66e4","url":"https://github.com/trending?l=TextMate-Properties"},"Thrift":{"color":"#D12127","url":"https://github.com/trending?l=Thrift"},"TI Program":{"color":"#A0AA87","url":"https://github.com/trending?l=TI-Program"},"TLA":{"color":"#4b0079","url":"https://github.com/trending?l=TLA"},"TOML":{"color":"#9c4221","url":"https://github.com/trending?l=TOML"},"TSQL":{"color":"#e38c00","url":"https://github.com/trending?l=TSQL"},"TSV":{"color":"#237346","url":"https://github.com/trending?l=TSV"},"TSX":{"color":"#2b7489","url":"https://github.com/trending?l=TSX"},"Turing":{"color":"#cf142b","url":"https://github.com/trending?l=Turing"},"Twig":{"color":"#c1d026","url":"https://github.com/trending?l=Twig"},"TXL":{"color":"#0178b8","url":"https://github.com/trending?l=TXL"},"TypeScript":{"color":"#2b7489","url":"https://github.com/trending?l=TypeScript"},"Unified Parallel C":{"color":"#4e3617","url":"https://github.com/trending?l=Unified-Parallel-C"},"Unity3D Asset":{"color":"#222c37","url":"https://github.com/trending?l=Unity3D-Asset"},"Unix Assembly":{"color":null,"url":"https://github.com/trending?l=Unix-Assembly"},"Uno":{"color":"#9933cc","url":"https://github.com/trending?l=Uno"},"UnrealScript":{"color":"#a54c4d","url":"https://github.com/trending?l=UnrealScript"},"UrWeb":{"color":"#ccccee","url":"https://github.com/trending?l=UrWeb"},"V":{"color":"#4f87c4","url":"https://github.com/trending?l=V"},"Vala":{"color":"#a56de2","url":"https://github.com/trending?l=Vala"},"Valve Data Format":{"color":"#f26025","url":"https://github.com/trending?l=Valve-Data-Format"},"VBA":{"color":"#867db1","url":"https://github.com/trending?l=VBA"},"VBScript":{"color":"#15dcdc","url":"https://github.com/trending?l=VBScript"},"VCL":{"color":"#148AA8","url":"https://github.com/trending?l=VCL"},"Verilog":{"color":"#b2b7f8","url":"https://github.com/trending?l=Verilog"},"VHDL":{"color":"#adb2cb","url":"https://github.com/trending?l=VHDL"},"Vim Help File":{"color":"#199f4b","url":"https://github.com/trending?l=Vim-Help-File"},"Vim Script":{"color":"#199f4b","url":"https://github.com/trending?l=Vim-Script"},"Vim Snippet":{"color":"#199f4b","url":"https://github.com/trending?l=Vim-Snippet"},"Visual Basic .NET":{"color":"#945db7","url":"https://github.com/trending?l=Visual-Basic-.NET"},"Volt":{"color":"#1F1F1F","url":"https://github.com/trending?l=Volt"},"Vue":{"color":"#41b883","url":"https://github.com/trending?l=Vue"},"Vyper":{"color":"#2980b9","url":"https://github.com/trending?l=Vyper"},"wdl":{"color":"#42f1f4","url":"https://github.com/trending?l=wdl"},"Web Ontology Language":{"color":"#5b70bd","url":"https://github.com/trending?l=Web-Ontology-Language"},"WebAssembly":{"color":"#04133b","url":"https://github.com/trending?l=WebAssembly"},"WebIDL":{"color":null,"url":"https://github.com/trending?l=WebIDL"},"Whiley":{"color":"#d5c397","url":"https://github.com/trending?l=Whiley"},"Wikitext":{"color":"#fc5757","url":"https://github.com/trending?l=Wikitext"},"Windows Registry Entries":{"color":"#52d5ff","url":"https://github.com/trending?l=Windows-Registry-Entries"},"wisp":{"color":"#7582D1","url":"https://github.com/trending?l=wisp"},"Witcher Script":{"color":"#ff0000","url":"https://github.com/trending?l=Witcher-Script"},"Wollok":{"color":"#a23738","url":"https://github.com/trending?l=Wollok"},"World of Warcraft Addon Data":{"color":"#f7e43f","url":"https://github.com/trending?l=World-of-Warcraft-Addon-Data"},"X10":{"color":"#4B6BEF","url":"https://github.com/trending?l=X10"},"xBase":{"color":"#403a40","url":"https://github.com/trending?l=xBase"},"XC":{"color":"#99DA07","url":"https://github.com/trending?l=XC"},"XML":{"color":"#0060ac","url":"https://github.com/trending?l=XML"},"XML Property List":{"color":"#0060ac","url":"https://github.com/trending?l=XML-Property-List"},"Xojo":{"color":"#81bd41","url":"https://github.com/trending?l=Xojo"},"Xonsh":{"color":"#285EEF","url":"https://github.com/trending?l=Xonsh"},"XProc":{"color":null,"url":"https://github.com/trending?l=XProc"},"XQuery":{"color":"#5232e7","url":"https://github.com/trending?l=XQuery"},"XS":{"color":null,"url":"https://github.com/trending?l=XS"},"XSLT":{"color":"#EB8CEB","url":"https://github.com/trending?l=XSLT"},"Xtend":{"color":"#24255d","url":"https://github.com/trending?l=Xtend"},"Yacc":{"color":"#4B6C4B","url":"https://github.com/trending?l=Yacc"},"YAML":{"color":"#cb171e","url":"https://github.com/trending?l=YAML"},"YARA":{"color":"#220000","url":"https://github.com/trending?l=YARA"},"YASnippet":{"color":"#32AB90","url":"https://github.com/trending?l=YASnippet"},"Yul":{"color":"#794932","url":"https://github.com/trending?l=Yul"},"ZAP":{"color":"#0d665e","url":"https://github.com/trending?l=ZAP"},"Zeek":{"color":null,"url":"https://github.com/trending?l=Zeek"},"ZenScript":{"color":"#00BCD1","url":"https://github.com/trending?l=ZenScript"},"Zephir":{"color":"#118f9e","url":"https://github.com/trending?l=Zephir"},"Zig":{"color":"#ec915c","url":"https://github.com/trending?l=Zig"},"ZIL":{"color":"#dc75e5","url":"https://github.com/trending?l=ZIL"},"Zimpl":{"color":"#d67711","url":"https://github.com/trending?l=Zimpl"}} \ No newline at end of file +{"1C Enterprise":{"color":"#814CCC"},"2-Dimensional Array":{"color":"#38761D"},"4D":{"color":"#004289"},"ABAP":{"color":"#E8274B"},"ABAP CDS":{"color":"#555e25"},"ActionScript":{"color":"#882B0F"},"Ada":{"color":"#02f88c"},"Adblock Filter List":{"color":"#800000"},"Adobe Font Metrics":{"color":"#fa0f00"},"Agda":{"color":"#315665"},"AGS Script":{"color":"#B9D9FF"},"AIDL":{"color":"#34EB6B"},"AL":{"color":"#3AA2B5"},"Alloy":{"color":"#64C800"},"Alpine Abuild":{"color":"#0D597F"},"Altium Designer":{"color":"#A89663"},"AMPL":{"color":"#E6EFBB"},"AngelScript":{"color":"#C7D7DC"},"Ant Build System":{"color":"#A9157E"},"Antlers":{"color":"#ff269e"},"ANTLR":{"color":"#9DC3FF"},"ApacheConf":{"color":"#d12127"},"Apex":{"color":"#1797c0"},"API Blueprint":{"color":"#2ACCA8"},"APL":{"color":"#5A8164"},"Apollo Guidance Computer":{"color":"#0B3D91"},"AppleScript":{"color":"#101F1F"},"Arc":{"color":"#aa2afe"},"AsciiDoc":{"color":"#73a0c5"},"ASL":{"color":null},"ASP.NET":{"color":"#9400ff"},"AspectJ":{"color":"#a957b0"},"Assembly":{"color":"#6E4C13"},"Astro":{"color":"#ff5a03"},"Asymptote":{"color":"#ff0000"},"ATS":{"color":"#1ac620"},"Augeas":{"color":"#9CC134"},"AutoHotkey":{"color":"#6594b9"},"AutoIt":{"color":"#1C3552"},"Avro IDL":{"color":"#0040FF"},"Awk":{"color":"#c30e9b"},"Ballerina":{"color":"#FF5000"},"BASIC":{"color":"#ff0000"},"Batchfile":{"color":"#C1F12E"},"Beef":{"color":"#a52f4e"},"Befunge":{"color":null},"Berry":{"color":"#15A13C"},"BibTeX":{"color":"#778899"},"Bicep":{"color":"#519aba"},"Bikeshed":{"color":"#5562ac"},"Bison":{"color":"#6A463F"},"BitBake":{"color":"#00bce4"},"Blade":{"color":"#f7523f"},"BlitzBasic":{"color":"#00FFAE"},"BlitzMax":{"color":"#cd6400"},"Bluespec":{"color":"#12223c"},"Bluespec BH":{"color":"#12223c"},"Boo":{"color":"#d4bec1"},"Boogie":{"color":"#c80fa0"},"BQN":{"color":"#2b7067"},"Brainfuck":{"color":"#2F2530"},"BrighterScript":{"color":"#66AABB"},"Brightscript":{"color":"#662D91"},"Browserslist":{"color":"#ffd539"},"C":{"color":"#555555"},"C#":{"color":"#178600"},"C++":{"color":"#f34b7d"},"C2hs Haskell":{"color":null},"Cabal Config":{"color":"#483465"},"Caddyfile":{"color":"#22b638"},"Cadence":{"color":"#00ef8b"},"Cairo":{"color":"#ff4a48"},"CameLIGO":{"color":"#3be133"},"CAP CDS":{"color":"#0092d1"},"Cap'n Proto":{"color":"#c42727"},"CartoCSS":{"color":null},"Ceylon":{"color":"#dfa535"},"Chapel":{"color":"#8dc63f"},"Charity":{"color":null},"ChucK":{"color":"#3f8000"},"Circom":{"color":"#707575"},"Cirru":{"color":"#ccccff"},"Clarion":{"color":"#db901e"},"Clarity":{"color":"#5546ff"},"Classic ASP":{"color":"#6a40fd"},"Clean":{"color":"#3F85AF"},"Click":{"color":"#E4E6F3"},"CLIPS":{"color":"#00A300"},"Clojure":{"color":"#db5855"},"Closure Templates":{"color":"#0d948f"},"Cloud Firestore Security Rules":{"color":"#FFA000"},"CMake":{"color":"#DA3434"},"COBOL":{"color":null},"CodeQL":{"color":"#140f46"},"CoffeeScript":{"color":"#244776"},"ColdFusion":{"color":"#ed2cd6"},"ColdFusion CFC":{"color":"#ed2cd6"},"COLLADA":{"color":"#F1A42B"},"Common Lisp":{"color":"#3fb68b"},"Common Workflow Language":{"color":"#B5314C"},"Component Pascal":{"color":"#B0CE4E"},"Cool":{"color":null},"Coq":{"color":"#d0b68c"},"crontab":{"color":"#ead7ac"},"Crystal":{"color":"#000100"},"CSON":{"color":"#244776"},"Csound":{"color":"#1a1a1a"},"Csound Document":{"color":"#1a1a1a"},"Csound Score":{"color":"#1a1a1a"},"CSS":{"color":"#563d7c"},"CSV":{"color":"#237346"},"Cuda":{"color":"#3A4E3A"},"CUE":{"color":"#5886E1"},"Curry":{"color":"#531242"},"CWeb":{"color":"#00007a"},"Cycript":{"color":null},"Cypher":{"color":"#34c0eb"},"Cython":{"color":"#fedf5b"},"D":{"color":"#ba595e"},"D2":{"color":"#526ee8"},"Dafny":{"color":"#FFEC25"},"Darcs Patch":{"color":"#8eff23"},"Dart":{"color":"#00B4AB"},"DataWeave":{"color":"#003a52"},"Debian Package Control File":{"color":"#D70751"},"DenizenScript":{"color":"#FBEE96"},"Dhall":{"color":"#dfafff"},"DIGITAL Command Language":{"color":null},"DirectX 3D File":{"color":"#aace60"},"DM":{"color":"#447265"},"Dockerfile":{"color":"#384d54"},"Dogescript":{"color":"#cca760"},"Dotenv":{"color":"#e5d559"},"DTrace":{"color":null},"Dylan":{"color":"#6c616e"},"E":{"color":"#ccce35"},"Earthly":{"color":"#2af0ff"},"Easybuild":{"color":"#069406"},"eC":{"color":"#913960"},"Ecere Projects":{"color":"#913960"},"ECL":{"color":"#8a1267"},"ECLiPSe":{"color":"#001d9d"},"Ecmarkup":{"color":"#eb8131"},"Edge":{"color":"#0dffe0"},"EdgeQL":{"color":"#31A7FF"},"EditorConfig":{"color":"#fff1f2"},"Eiffel":{"color":"#4d6977"},"EJS":{"color":"#a91e50"},"Elixir":{"color":"#6e4a7e"},"Elm":{"color":"#60B5CC"},"Elvish":{"color":"#55BB55"},"Elvish Transcript":{"color":"#55BB55"},"Emacs Lisp":{"color":"#c065db"},"EmberScript":{"color":"#FFF4F3"},"EQ":{"color":"#a78649"},"Erlang":{"color":"#B83998"},"Euphoria":{"color":"#FF790B"},"F#":{"color":"#b845fc"},"F*":{"color":"#572e30"},"Factor":{"color":"#636746"},"Fancy":{"color":"#7b9db4"},"Fantom":{"color":"#14253c"},"Faust":{"color":"#c37240"},"Fennel":{"color":"#fff3d7"},"FIGlet Font":{"color":"#FFDDBB"},"Filebench WML":{"color":"#F6B900"},"Filterscript":{"color":null},"FIRRTL":{"color":"#2f632f"},"fish":{"color":"#4aae47"},"Fluent":{"color":"#ffcc33"},"FLUX":{"color":"#88ccff"},"Forth":{"color":"#341708"},"Fortran":{"color":"#4d41b1"},"Fortran Free Form":{"color":"#4d41b1"},"FreeBasic":{"color":"#141AC9"},"FreeMarker":{"color":"#0050b2"},"Frege":{"color":"#00cafe"},"Futhark":{"color":"#5f021f"},"G-code":{"color":"#D08CF2"},"Game Maker Language":{"color":"#71b417"},"GAML":{"color":"#FFC766"},"GAMS":{"color":"#f49a22"},"GAP":{"color":"#0000cc"},"GCC Machine Description":{"color":"#FFCFAB"},"GDB":{"color":null},"GDScript":{"color":"#355570"},"GEDCOM":{"color":"#003058"},"Gemfile.lock":{"color":"#701516"},"Gemini":{"color":"#ff6900"},"Genero 4gl":{"color":"#63408e"},"Genero per":{"color":"#d8df39"},"Genie":{"color":"#fb855d"},"Genshi":{"color":"#951531"},"Gentoo Ebuild":{"color":"#9400ff"},"Gentoo Eclass":{"color":"#9400ff"},"Gerber Image":{"color":"#d20b00"},"Gherkin":{"color":"#5B2063"},"Git Attributes":{"color":"#F44D27"},"Git Config":{"color":"#F44D27"},"Git Revision List":{"color":"#F44D27"},"Gleam":{"color":"#ffaff3"},"Glimmer JS":{"color":"#F5835F"},"Glimmer TS":{"color":"#3178c6"},"GLSL":{"color":"#5686a5"},"Glyph":{"color":"#c1ac7f"},"Gnuplot":{"color":"#f0a9f0"},"Go":{"color":"#00ADD8"},"Go Checksums":{"color":"#00ADD8"},"Go Module":{"color":"#00ADD8"},"Go Workspace":{"color":"#00ADD8"},"Godot Resource":{"color":"#355570"},"Golo":{"color":"#88562A"},"Gosu":{"color":"#82937f"},"Grace":{"color":"#615f8b"},"Gradle":{"color":"#02303a"},"Gradle Kotlin DSL":{"color":"#02303a"},"Grammatical Framework":{"color":"#ff0000"},"GraphQL":{"color":"#e10098"},"Graphviz (DOT)":{"color":"#2596be"},"Groovy":{"color":"#4298b8"},"Groovy Server Pages":{"color":"#4298b8"},"GSC":{"color":"#FF6800"},"Hack":{"color":"#878787"},"Haml":{"color":"#ece2a9"},"Handlebars":{"color":"#f7931e"},"HAProxy":{"color":"#106da9"},"Harbour":{"color":"#0e60e3"},"Haskell":{"color":"#5e5086"},"Haxe":{"color":"#df7900"},"HCL":{"color":"#844FBA"},"HiveQL":{"color":"#dce200"},"HLSL":{"color":"#aace60"},"HOCON":{"color":"#9ff8ee"},"HolyC":{"color":"#ffefaf"},"hoon":{"color":"#00b171"},"Hosts File":{"color":"#308888"},"HTML":{"color":"#e34c26"},"HTML+ECR":{"color":"#2e1052"},"HTML+EEX":{"color":"#6e4a7e"},"HTML+ERB":{"color":"#701516"},"HTML+PHP":{"color":"#4f5d95"},"HTML+Razor":{"color":"#512be4"},"HTTP":{"color":"#005C9C"},"HXML":{"color":"#f68712"},"Hy":{"color":"#7790B2"},"HyPhy":{"color":null},"IDL":{"color":"#a3522f"},"Idris":{"color":"#b30000"},"Ignore List":{"color":"#000000"},"IGOR Pro":{"color":"#0000cc"},"ImageJ Macro":{"color":"#99AAFF"},"Imba":{"color":"#16cec6"},"Inform 7":{"color":null},"INI":{"color":"#d1dbe0"},"Ink":{"color":null},"Inno Setup":{"color":"#264b99"},"Io":{"color":"#a9188d"},"Ioke":{"color":"#078193"},"Isabelle":{"color":"#FEFE00"},"Isabelle ROOT":{"color":"#FEFE00"},"J":{"color":"#9EEDFF"},"Janet":{"color":"#0886a5"},"JAR Manifest":{"color":"#b07219"},"Jasmin":{"color":"#d03600"},"Java":{"color":"#b07219"},"Java Properties":{"color":"#2A6277"},"Java Server Pages":{"color":"#2A6277"},"JavaScript":{"color":"#f1e05a"},"JavaScript+ERB":{"color":"#f1e05a"},"JCL":{"color":"#d90e09"},"Jest Snapshot":{"color":"#15c213"},"JetBrains MPS":{"color":"#21D789"},"JFlex":{"color":"#DBCA00"},"Jinja":{"color":"#a52a22"},"Jison":{"color":"#56b3cb"},"Jison Lex":{"color":"#56b3cb"},"Jolie":{"color":"#843179"},"jq":{"color":"#c7254e"},"JSON":{"color":"#292929"},"JSON with Comments":{"color":"#292929"},"JSON5":{"color":"#267CB9"},"JSONiq":{"color":"#40d47e"},"JSONLD":{"color":"#0c479c"},"Jsonnet":{"color":"#0064bd"},"Julia":{"color":"#a270ba"},"Julia REPL":{"color":"#a270ba"},"Jupyter Notebook":{"color":"#DA5B0B"},"Just":{"color":"#384d54"},"Kaitai Struct":{"color":"#773b37"},"KakouneScript":{"color":"#6f8042"},"KerboScript":{"color":"#41adf0"},"KiCad Layout":{"color":"#2f4aab"},"KiCad Legacy Layout":{"color":"#2f4aab"},"KiCad Schematic":{"color":"#2f4aab"},"Kotlin":{"color":"#A97BFF"},"KRL":{"color":"#28430A"},"kvlang":{"color":"#1da6e0"},"LabVIEW":{"color":"#fede06"},"Lark":{"color":"#2980B9"},"Lasso":{"color":"#999999"},"Latte":{"color":"#f2a542"},"Lean":{"color":null},"Lean 4":{"color":null},"Less":{"color":"#1d365d"},"Lex":{"color":"#DBCA00"},"LFE":{"color":"#4C3023"},"LigoLANG":{"color":"#0e74ff"},"LilyPond":{"color":"#9ccc7c"},"Limbo":{"color":null},"Liquid":{"color":"#67b8de"},"Literate Agda":{"color":"#315665"},"Literate CoffeeScript":{"color":"#244776"},"Literate Haskell":{"color":"#5e5086"},"LiveScript":{"color":"#499886"},"LLVM":{"color":"#185619"},"Logos":{"color":null},"Logtalk":{"color":"#295b9a"},"LOLCODE":{"color":"#cc9900"},"LookML":{"color":"#652B81"},"LoomScript":{"color":null},"LSL":{"color":"#3d9970"},"Lua":{"color":"#000080"},"Luau":{"color":"#00A2FF"},"M":{"color":null},"M4":{"color":null},"M4Sugar":{"color":null},"Macaulay2":{"color":"#d8ffff"},"Makefile":{"color":"#427819"},"Mako":{"color":"#7e858d"},"Markdown":{"color":"#083fa1"},"Marko":{"color":"#42bff2"},"Mask":{"color":"#f97732"},"Mathematica":{"color":"#dd1100"},"MATLAB":{"color":"#e16737"},"Max":{"color":"#c4a79c"},"MAXScript":{"color":"#00a6a6"},"mcfunction":{"color":"#E22837"},"MDX":{"color":"#fcb32c"},"Mercury":{"color":"#ff2b2b"},"Mermaid":{"color":"#ff3670"},"Meson":{"color":"#007800"},"Metal":{"color":"#8f14e9"},"MiniD":{"color":null},"MiniYAML":{"color":"#ff1111"},"Mint":{"color":"#02b046"},"Mirah":{"color":"#c7a938"},"mIRC Script":{"color":"#3d57c3"},"MLIR":{"color":"#5EC8DB"},"Modelica":{"color":"#de1d31"},"Modula-2":{"color":"#10253f"},"Modula-3":{"color":"#223388"},"Module Management System":{"color":null},"Mojo":{"color":"#ff4c1f"},"Monkey":{"color":null},"Monkey C":{"color":"#8D6747"},"Moocode":{"color":null},"MoonScript":{"color":"#ff4585"},"Motoko":{"color":"#fbb03b"},"Motorola 68K Assembly":{"color":"#005daa"},"Move":{"color":"#4a137a"},"MQL4":{"color":"#62A8D6"},"MQL5":{"color":"#4A76B8"},"MTML":{"color":"#b7e1f4"},"MUF":{"color":null},"mupad":{"color":"#244963"},"Mustache":{"color":"#724b3b"},"Myghty":{"color":null},"nanorc":{"color":"#2d004d"},"Nasal":{"color":"#1d2c4e"},"NASL":{"color":null},"NCL":{"color":"#28431f"},"Nearley":{"color":"#990000"},"Nemerle":{"color":"#3d3c6e"},"nesC":{"color":"#94B0C7"},"NetLinx":{"color":"#0aa0ff"},"NetLinx+ERB":{"color":"#747faa"},"NetLogo":{"color":"#ff6375"},"NewLisp":{"color":"#87AED7"},"Nextflow":{"color":"#3ac486"},"Nginx":{"color":"#009639"},"Nim":{"color":"#ffc200"},"Nit":{"color":"#009917"},"Nix":{"color":"#7e7eff"},"NMODL":{"color":"#00356B"},"NPM Config":{"color":"#cb3837"},"NSIS":{"color":null},"Nu":{"color":"#c9df40"},"NumPy":{"color":"#9C8AF9"},"Nunjucks":{"color":"#3d8137"},"Nushell":{"color":"#4E9906"},"NWScript":{"color":"#111522"},"OASv2-json":{"color":"#85ea2d"},"OASv2-yaml":{"color":"#85ea2d"},"OASv3-json":{"color":"#85ea2d"},"OASv3-yaml":{"color":"#85ea2d"},"Oberon":{"color":null},"Objective-C":{"color":"#438eff"},"Objective-C++":{"color":"#6866fb"},"Objective-J":{"color":"#ff0c5a"},"ObjectScript":{"color":"#424893"},"OCaml":{"color":"#ef7a08"},"Odin":{"color":"#60AFFE"},"Omgrofl":{"color":"#cabbff"},"ooc":{"color":"#b0b77e"},"Opa":{"color":null},"Opal":{"color":"#f7ede0"},"Open Policy Agent":{"color":"#7d9199"},"OpenAPI Specification v2":{"color":"#85ea2d"},"OpenAPI Specification v3":{"color":"#85ea2d"},"OpenCL":{"color":"#ed2e2d"},"OpenEdge ABL":{"color":"#5ce600"},"OpenQASM":{"color":"#AA70FF"},"OpenRC runscript":{"color":null},"OpenSCAD":{"color":"#e5cd45"},"Option List":{"color":"#476732"},"Org":{"color":"#77aa99"},"Ox":{"color":null},"Oxygene":{"color":"#cdd0e3"},"Oz":{"color":"#fab738"},"P4":{"color":"#7055b5"},"Pact":{"color":"#F7A8B8"},"Pan":{"color":"#cc0000"},"Papyrus":{"color":"#6600cc"},"Parrot":{"color":"#f3ca0a"},"Parrot Assembly":{"color":null},"Parrot Internal Representation":{"color":null},"Pascal":{"color":"#E3F171"},"Pawn":{"color":"#dbb284"},"PDDL":{"color":"#0d00ff"},"PEG.js":{"color":"#234d6b"},"Pep8":{"color":"#C76F5B"},"Perl":{"color":"#0298c3"},"PHP":{"color":"#4F5D95"},"PicoLisp":{"color":"#6067af"},"PigLatin":{"color":"#fcd7de"},"Pike":{"color":"#005390"},"Pip Requirements":{"color":"#FFD343"},"Pkl":{"color":"#6b9543"},"PlantUML":{"color":"#fbbd16"},"PLpgSQL":{"color":"#336790"},"PLSQL":{"color":"#dad8d8"},"PogoScript":{"color":"#d80074"},"Polar":{"color":"#ae81ff"},"Pony":{"color":null},"Portugol":{"color":"#f8bd00"},"PostCSS":{"color":"#dc3a0c"},"PostScript":{"color":"#da291c"},"POV-Ray SDL":{"color":"#6bac65"},"PowerBuilder":{"color":"#8f0f8d"},"PowerShell":{"color":"#012456"},"Praat":{"color":"#c8506d"},"Prisma":{"color":"#0c344b"},"Processing":{"color":"#0096D8"},"Procfile":{"color":"#3B2F63"},"Prolog":{"color":"#74283c"},"Promela":{"color":"#de0000"},"Propeller Spin":{"color":"#7fa2a7"},"Pug":{"color":"#a86454"},"Puppet":{"color":"#302B6D"},"PureBasic":{"color":"#5a6986"},"PureScript":{"color":"#1D222D"},"Pyret":{"color":"#ee1e10"},"Python":{"color":"#3572A5"},"Python console":{"color":"#3572A5"},"Python traceback":{"color":"#3572A5"},"q":{"color":"#0040cd"},"Q#":{"color":"#fed659"},"QMake":{"color":null},"QML":{"color":"#44a51c"},"Qt Script":{"color":"#00b841"},"Quake":{"color":"#882233"},"R":{"color":"#198CE7"},"Racket":{"color":"#3c5caa"},"Ragel":{"color":"#9d5200"},"Raku":{"color":"#0000fb"},"RAML":{"color":"#77d9fb"},"Rascal":{"color":"#fffaa0"},"RBS":{"color":"#701516"},"RDoc":{"color":"#701516"},"REALbasic":{"color":null},"Reason":{"color":"#ff5847"},"ReasonLIGO":{"color":"#ff5847"},"Rebol":{"color":"#358a5b"},"Record Jar":{"color":"#0673ba"},"Red":{"color":"#f50000"},"Redcode":{"color":null},"Regular Expression":{"color":"#009a00"},"Ren'Py":{"color":"#ff7f7f"},"RenderScript":{"color":null},"ReScript":{"color":"#ed5051"},"reStructuredText":{"color":"#141414"},"REXX":{"color":"#d90e09"},"Rez":{"color":"#FFDAB3"},"Ring":{"color":"#2D54CB"},"Riot":{"color":"#A71E49"},"RMarkdown":{"color":"#198ce7"},"RobotFramework":{"color":"#00c0b5"},"Roc":{"color":"#7c38f5"},"Roff":{"color":"#ecdebe"},"Roff Manpage":{"color":"#ecdebe"},"RON":{"color":"#a62c00"},"Rouge":{"color":"#cc0088"},"RouterOS Script":{"color":"#DE3941"},"RPC":{"color":null},"RPGLE":{"color":"#2BDE21"},"Ruby":{"color":"#701516"},"RUNOFF":{"color":"#665a4e"},"Rust":{"color":"#dea584"},"Sage":{"color":null},"SaltStack":{"color":"#646464"},"SAS":{"color":"#B34936"},"Sass":{"color":"#a53b70"},"Scala":{"color":"#c22d40"},"Scaml":{"color":"#bd181a"},"Scenic":{"color":"#fdc700"},"Scheme":{"color":"#1e4aec"},"Scilab":{"color":"#ca0f21"},"SCSS":{"color":"#c6538c"},"sed":{"color":"#64b970"},"Self":{"color":"#0579aa"},"ShaderLab":{"color":"#222c37"},"Shell":{"color":"#89e051"},"ShellCheck Config":{"color":"#cecfcb"},"ShellSession":{"color":null},"Shen":{"color":"#120F14"},"Sieve":{"color":null},"Simple File Verification":{"color":"#C9BFED"},"Singularity":{"color":"#64E6AD"},"Slash":{"color":"#007eff"},"Slice":{"color":"#003fa2"},"Slim":{"color":"#2b2b2b"},"Slint":{"color":"#2379F4"},"Smali":{"color":null},"Smalltalk":{"color":"#596706"},"Smarty":{"color":"#f0c040"},"Smithy":{"color":"#c44536"},"SmPL":{"color":"#c94949"},"SMT":{"color":null},"Snakemake":{"color":"#419179"},"Solidity":{"color":"#AA6746"},"SourcePawn":{"color":"#f69e1d"},"SPARQL":{"color":"#0C4597"},"SQF":{"color":"#3F3F3F"},"SQL":{"color":"#e38c00"},"SQLPL":{"color":"#e38c00"},"Squirrel":{"color":"#800000"},"SRecode Template":{"color":"#348a34"},"Stan":{"color":"#b2011d"},"Standard ML":{"color":"#dc566d"},"Starlark":{"color":"#76d275"},"Stata":{"color":"#1a5f91"},"STL":{"color":"#373b5e"},"StringTemplate":{"color":"#3fb34f"},"Stylus":{"color":"#ff6347"},"SubRip Text":{"color":"#9e0101"},"SugarSS":{"color":"#2fcc9f"},"SuperCollider":{"color":"#46390b"},"Svelte":{"color":"#ff3e00"},"SVG":{"color":"#ff9900"},"Sway":{"color":"#00F58C"},"Sweave":{"color":"#198ce7"},"Swift":{"color":"#F05138"},"SWIG":{"color":null},"SystemVerilog":{"color":"#DAE1C2"},"Talon":{"color":"#333333"},"Tcl":{"color":"#e4cc98"},"Tcsh":{"color":null},"templ":{"color":"#66D0DD"},"Terra":{"color":"#00004c"},"Terraform Template":{"color":"#7b42bb"},"TeX":{"color":"#3D6117"},"TextGrid":{"color":"#c8506d"},"Textile":{"color":"#ffe7ac"},"TextMate Properties":{"color":"#df66e4"},"Thrift":{"color":"#D12127"},"TI Program":{"color":"#A0AA87"},"TL-Verilog":{"color":"#C40023"},"TLA":{"color":"#4b0079"},"Toit":{"color":"#c2c9fb"},"TOML":{"color":"#9c4221"},"TSQL":{"color":"#e38c00"},"TSV":{"color":"#237346"},"TSX":{"color":"#3178c6"},"Turing":{"color":"#cf142b"},"Twig":{"color":"#c1d026"},"TXL":{"color":"#0178b8"},"TypeScript":{"color":"#3178c6"},"Typst":{"color":"#239dad"},"Unified Parallel C":{"color":"#4e3617"},"Unity3D Asset":{"color":"#222c37"},"Unix Assembly":{"color":null},"Uno":{"color":"#9933cc"},"UnrealScript":{"color":"#a54c4d"},"UrWeb":{"color":"#ccccee"},"V":{"color":"#4f87c4"},"Vala":{"color":"#a56de2"},"Valve Data Format":{"color":"#f26025"},"VBA":{"color":"#867db1"},"VBScript":{"color":"#15dcdc"},"VCL":{"color":"#148AA8"},"Velocity Template Language":{"color":"#507cff"},"Verilog":{"color":"#b2b7f8"},"VHDL":{"color":"#adb2cb"},"Vim Help File":{"color":"#199f4b"},"Vim Script":{"color":"#199f4b"},"Vim Snippet":{"color":"#199f4b"},"Visual Basic .NET":{"color":"#945db7"},"Visual Basic 6.0":{"color":"#2c6353"},"Volt":{"color":"#1F1F1F"},"Vue":{"color":"#41b883"},"Vyper":{"color":"#2980b9"},"WDL":{"color":"#42f1f4"},"Web Ontology Language":{"color":"#5b70bd"},"WebAssembly":{"color":"#04133b"},"WebAssembly Interface Type":{"color":"#6250e7"},"WebIDL":{"color":null},"WGSL":{"color":"#1a5e9a"},"Whiley":{"color":"#d5c397"},"Wikitext":{"color":"#fc5757"},"Windows Registry Entries":{"color":"#52d5ff"},"wisp":{"color":"#7582D1"},"Witcher Script":{"color":"#ff0000"},"Wollok":{"color":"#a23738"},"World of Warcraft Addon Data":{"color":"#f7e43f"},"Wren":{"color":"#383838"},"X10":{"color":"#4B6BEF"},"xBase":{"color":"#403a40"},"XC":{"color":"#99DA07"},"XML":{"color":"#0060ac"},"XML Property List":{"color":"#0060ac"},"Xojo":{"color":"#81bd41"},"Xonsh":{"color":"#285EEF"},"XProc":{"color":null},"XQuery":{"color":"#5232e7"},"XS":{"color":null},"XSLT":{"color":"#EB8CEB"},"Xtend":{"color":"#24255d"},"Yacc":{"color":"#4B6C4B"},"YAML":{"color":"#cb171e"},"YARA":{"color":"#220000"},"YASnippet":{"color":"#32AB90"},"Yul":{"color":"#794932"},"ZAP":{"color":"#0d665e"},"Zeek":{"color":null},"ZenScript":{"color":"#00BCD1"},"Zephir":{"color":"#118f9e"},"Zig":{"color":"#ec915c"},"ZIL":{"color":"#dc75e5"},"Zimpl":{"color":"#d67711"}} diff --git a/lib/github_colour.dart b/lib/github_colour.dart index 06bdc8c..b3e9f39 100644 --- a/lib/github_colour.dart +++ b/lib/github_colour.dart @@ -3,262 +3,6 @@ /// [Color]. library github_colour; -import 'dart:collection'; -import 'dart:convert'; - -import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart' - show Color, ColorSwatch, WidgetsFlutterBinding; -import 'package:http/http.dart' as http show get; -import 'package:meta/meta.dart' show sealed; - -import 'src/cache/cache.dart'; -import 'src/cache/exception.dart'; -import 'src/exception.dart'; - export 'src/cache/exception.dart'; export 'src/exception.dart'; - -const String _src = - "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json"; - -/// A handler when no language data found in [GitHubColour.find]. -typedef LanguageUndefinedHandler = Color Function(); - -/// An [Error] thrown when response unsuccessfully and no cache can be used. -class GitHubColourHTTPLoadFailedError extends GitHubColourLoadFailedError { - /// HTTP response code when fetching colour data. - final int responseCode; - - GitHubColourHTTPLoadFailedError._(this.responseCode) - : assert(responseCode != 200), - super(); - - @override - String toString() => - "GitHubColourLoadFailedError: Can not receive GitHub language colour from server with HTTP code $responseCode."; -} - -/// An [Error] thrown when no resources available to initalize [GitHubColour]. -class GitHubColourNoAvailableResourceError extends GitHubColourLoadFailedError { - GitHubColourNoAvailableResourceError._() : super(); - - @override - String toString() => - "GitHubColourNoAvailableResourceError: Unable to read GitHub colour data with all available sources."; -} - -/// An [Error] when no colour data of the language. -@Deprecated("This exception will be removed with find()") -class UndefinedLanguageColourError extends ArgumentError - implements GitHubColourThrowable { - /// Undefined language name. - final String undefinedLanguage; - - UndefinedLanguageColourError._(this.undefinedLanguage) - : super("Unknown language '$undefinedLanguage'", - "UndefinedLanguageColourError"); -} - -Color _hex2C(String hex, [String alphaHex = "ff"]) { - assert(RegExp(r"^#[0-9a-f]{6}$", caseSensitive: false).hasMatch(hex)); - assert(RegExp(r"^[0-9a-f]{2}$", caseSensitive: false).hasMatch(alphaHex)); - - return Color( - int.parse("$alphaHex${hex.substring(1)}".toUpperCase(), radix: 16)); -} - -Map _colourReader(String json) => - (jsonDecode(json) as Map).map( - (language, node) => MapEntry( - language, _hex2C(node["color"] ?? GitHubColour._defaultColourHex))); - -/// A class for getting GitHub language colour. -/// -/// Since 2.0.0, [GitHubColour] implemented [ColorSwatch] that getting colour -/// can be more convenience. And serval old API will be [Deprecated]. -@sealed -class GitHubColour extends UnmodifiableMapBase - implements ColorSwatch { - static GitHubColour? _instance; - final Map _githubLangColour; - - /// A [String] of hex value when the language is undefined or null. - static const String _defaultColourHex = "#f0f0f0"; - - /// [Color] object of [defaultColourHex]. - static Color get _defaultColour => _hex2C(_defaultColourHex); - - GitHubColour._(Map githubLangColour) - : this._githubLangColour = Map.unmodifiable(githubLangColour); - - /// Construct an instance of [GitHubColour]. - /// - /// If no instance created, it will construct and will be reused when - /// [getInstance] or [getExistedInstance] called again. - /// - /// If [offlineLastResort] enabled, it loads package's `colors.json` for - /// getting colour data offline. And it must be called after - /// [WidgetsFlutterBinding.ensureInitialized] invoked in `main()` method to - /// allow get offline colour data from [rootBundle]. - /// - /// When all resources failed, it throws - /// [GitHubColourNoAvailableResourceError]. If [offlineLastResort] disabled, - /// either [GitHubColourHTTPLoadFailedError] (if network available) or - /// [Exception] that repersenting no network state (e.g - /// [SocketException](https://api.dart.dev/stable/dart-io/SocketException-class.html) - /// in `"dart:io"` package). - /// - /// [offlineLastResort] only works when [getInstance] invoked first time - /// in entire runtime. This parameter will be ignored once the instance - /// constructed. - /// - /// Since `1.2.0`, it added chechsum validation on the cache. When the cache's - /// checksum does not matched, it throws - /// [GitHubColourCacheChecksumMismatchedError]. - static Future getInstance( - {bool offlineLastResort = true}) async { - if (_instance == null) { - final Uri ghc = Uri.parse(_src); - Map ghjson; - - bool cacheSource = false; - - try { - var resp = await http.get(ghc); - if (resp.statusCode != 200) { - throw GitHubColourHTTPLoadFailedError._(resp.statusCode); - } - ghjson = _colourReader(resp.body); - } catch (neterr) { - try { - // Second source. - ghjson = await getCache(); - cacheSource = true; - } catch (cerr) { - if (!offlineLastResort) { - // When offline last resort disabled. - throw neterr; - } - - try { - // Use provided JSON file as last resort. - ghjson = _colourReader(await rootBundle.loadString( - "packages/github_colour/colors.json", - cache: false)); - } catch (bundleerr) { - throw GitHubColourNoAvailableResourceError._(); - } - } - } - - if (!cacheSource) { - // Do nothing if received data is exact same with source. - await saveCache(ghjson); - } - - _instance = GitHubColour._(ghjson); - } - - return _instance!; - } - - /// Get constructed instance which called [getInstance] early. - /// - /// It throws [UnimplementedError] if called with no existed instance. - static GitHubColour getExistedInstance() { - if (_instance == null) { - throw UnimplementedError("No existed instance found in GitHubColour"); - } - - return _instance!; - } - - /// Find [Color] for the [language] (case sensitive). - /// - /// If [language] is undefined or defined with `null`, it calls [onUndefined] - /// for getting fallback [Color]. By default, it throws - /// [UndefinedLanguageColourError]. - @Deprecated("You can uses operator [] now.") - Color find(String language, {LanguageUndefinedHandler? onUndefined}) => - _githubLangColour[language] ?? - (onUndefined ?? - () { - throw UndefinedLanguageColourError._(language); - })(); - - /// Check does the [language] existed. - @Deprecated("Please uses containsKey") - bool contains(String language) => containsKey(language); - - /// **This method do absolutely nothing with parsed paramenters and will - /// be removed later** - /// - /// ~~Export all recorded of [GitHubColour] data to [ColorSwatch] with [String] - /// as index.~~ - /// - /// ~~By default, [includeDefault] set as `false`. If `true`, the [ColorSwatch] - /// will appended `__default__` index for repersenting [defaultColour] which - /// also is [ColorSwatch]'s default colour.~~ - /// - /// ~~If [overridePrimaryColour] applied and [find] existed [Color], it applied - /// as [ColorSwatch]'s primary colour instead of [defaultColour].~~ - @Deprecated( - "This method will be removed as GitHubColour implemented ColorSwatch") - ColorSwatch toSwatch( - {bool includeDefault = false, String? overridePrimaryColour}) => - this; - - /// Get a [Set] of [String] that contains all recorded langauages name. - @Deprecated("This getter is replaced by MapBase's keys.") - Set get listedLanguage => Set.unmodifiable(keys); - - /// Resolve [key] as language and find repersented [Color] from providers. - /// - /// If [key] is undefined, it returns default colour instead. - @override - Color operator [](Object? key) => _githubLangColour[key] ?? _defaultColour; - - @override - int get alpha => _defaultColour.red; - - @override - int get blue => _defaultColour.blue; - - @override - double computeLuminance() => _defaultColour.computeLuminance(); - - @override - int get green => _defaultColour.green; - - @override - Iterable get keys => Set.unmodifiable(_githubLangColour.keys); - - @override - double get opacity => _defaultColour.opacity; - - @override - int get red => _defaultColour.red; - - @override - int get value => _defaultColour.value; - - @override - Color withAlpha(int a) => _defaultColour.withAlpha(a); - - @override - Color withBlue(int b) => _defaultColour.withBlue(b); - - @override - Color withGreen(int g) => _defaultColour.withGreen(g); - - @override - Color withOpacity(double opacity) => _defaultColour.withOpacity(opacity); - - @override - Color withRed(int r) => _defaultColour.withRed(r); -} - -/// Alias type for repersenting "colour" in American English which does exactly -/// same with [GitHubColour]. -typedef GitHubColor = GitHubColour; +export 'src/swatch.dart'; diff --git a/lib/src/cache/cache.dart b/lib/src/cache/cache.dart index 8e611f7..2af111b 100644 --- a/lib/src/cache/cache.dart +++ b/lib/src/cache/cache.dart @@ -1,3 +1,3 @@ export 'cache_generic.dart' if (dart.library.io) "cache_vm.dart" - if (dart.library.html) "cache_web.dart"; + if (dart.library.js_interop) "cache_web.dart"; diff --git a/lib/src/cache/cache_generic.dart b/lib/src/cache/cache_generic.dart index 743ea11..464cccc 100644 --- a/lib/src/cache/cache_generic.dart +++ b/lib/src/cache/cache_generic.dart @@ -1,9 +1,12 @@ import 'package:flutter/widgets.dart' show Color; +import 'package:meta/meta.dart' show internal; +@internal Future saveCache(Map githubColour) async { throw UnsupportedError("No implementation in this platform"); } +@internal Future> getCache() async { throw UnsupportedError("No implementation in this platform"); } diff --git a/lib/src/cache/cache_vm.dart b/lib/src/cache/cache_vm.dart index 6d165d5..3916c5e 100644 --- a/lib/src/cache/cache_vm.dart +++ b/lib/src/cache/cache_vm.dart @@ -2,6 +2,7 @@ import "dart:io"; import 'dart:typed_data'; import 'package:flutter/widgets.dart' show Color; +import 'package:meta/meta.dart'; import "package:path/path.dart" as path; import "package:path_provider/path_provider.dart" as path_provider; @@ -45,6 +46,7 @@ Future get _cacheChecksum async { return checksum; } +@internal Future saveCache(Map githubColour) async { File tf = await _cacheFile; File cf = await _cacheChecksum; @@ -57,6 +59,7 @@ Future saveCache(Map githubColour) async { } } +@internal Future> getCache() async { File tf = await _cacheFile; diff --git a/lib/src/cache/cache_web.dart b/lib/src/cache/cache_web.dart index f209f56..64f5b38 100644 --- a/lib/src/cache/cache_web.dart +++ b/lib/src/cache/cache_web.dart @@ -1,37 +1,84 @@ -import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter/widgets.dart' show Color; -import 'package:shared_preferences/shared_preferences.dart'; +import 'package:meta/meta.dart' show internal; +import 'package:sembast/sembast.dart'; +import 'package:sembast/blob.dart'; +import 'package:sembast_web/sembast_web.dart'; import '../checksum.dart'; import "../compression.dart"; import '../conversion.dart'; import 'exception.dart'; -const String _spKey = "github_colour_cache"; -const String _spcKey = "github_colour_cache_checksum"; +const String _dbName = "github_colour_cache"; +const String _ctxKey = "cache_content"; +const String _checkKey = "cache_checksum"; +Future _openDB() { + DatabaseFactory dbf = databaseFactoryWeb; + + return dbf.openDatabase(_dbName); +} + +StoreRef _getStoreRef() => StoreRef("${_dbName}_store"); + +Future<(String, Uint8List)?> _getStoredChecksumAndCache( + Database db, StoreRef store) async { + var cache = await store.record(_ctxKey).get(db); + var checksum = await store.record(_checkKey).get(db); + + try { + return (checksum as String, decompressGHC((cache as Blob).bytes)); + } on TypeError { + return null; + } +} + +@internal Future saveCache(Map githubColour) async { - SharedPreferences sp = await SharedPreferences.getInstance(); + final Uint8List rghc = encodedColour(githubColour); + final Database db = await _openDB(); - Uint8List rghc = encodedColour(githubColour); + try { + final store = _getStoreRef(); - if (!isValidChecksum(sp.getString(_spcKey) ?? "", rghc)) { - // There are no ways to store bytes directly - await sp.setString(_spKey, base64Encode(compressGHC(rghc))); - await sp.setString(_spcKey, generateChecksum(rghc)); + var currentRecord = await _getStoredChecksumAndCache(db, store); + + if (currentRecord != null) { + var (currentChecksum, currentCache) = currentRecord; + + if (isValidChecksum(currentChecksum, currentCache)) return; + } + + await Future.wait([ + store.record(_ctxKey).put(db, Blob(compressGHC(rghc)), merge: false), + store.record(_checkKey).put(db, generateChecksum(rghc), merge: false) + ], eagerError: true); + } finally { + await db.close(); } } +@internal Future> getCache() async { - SharedPreferences sp = await SharedPreferences.getInstance(); + final Database db = await _openDB(); + + try { + final store = _getStoreRef(); - Uint8List rghc = decompressGHC(base64Decode(sp.getString(_spKey)!)); + var currentRecord = await _getStoredChecksumAndCache(db, store); + + if (currentRecord != null) { + var (currentChecksum, currentCache) = currentRecord; + + if (isValidChecksum(currentChecksum, currentCache)) { + return decodeColour(currentCache); + } + } - if (!isValidChecksum(sp.getString(_spcKey)!, rghc)) { throw GitHubColourCacheChecksumMismatchedError(); + } finally { + await db.close(); } - - return decodeColour(rghc); } diff --git a/lib/src/cache/exception.dart b/lib/src/cache/exception.dart index 75045bd..272c290 100644 --- a/lib/src/cache/exception.dart +++ b/lib/src/cache/exception.dart @@ -2,7 +2,7 @@ import '../exception.dart'; /// An [Error] when detected the cache file has been modified when getting /// online resource failed. -class GitHubColourCacheChecksumMismatchedError extends AssertionError +final class GitHubColourCacheChecksumMismatchedError extends AssertionError implements GitHubColourLoadFailedError { /// Construct an [Error] for checksum mismatched. GitHubColourCacheChecksumMismatchedError() diff --git a/lib/src/checksum.dart b/lib/src/checksum.dart index 93aefb2..f1eaa4f 100644 --- a/lib/src/checksum.dart +++ b/lib/src/checksum.dart @@ -1,14 +1,15 @@ import 'dart:typed_data'; -import "package:sha3/sha3.dart"; -import "package:hex/hex.dart"; +import 'package:hashlib/hashlib.dart'; +import 'package:meta/meta.dart' show internal; +@internal String generateChecksum(Uint8List rghc) { - SHA3 k = SHA3(256, SHA3_PADDING, 256); - k.update(rghc); - var hash = k.digest(); - return HEX.encode(hash); + final hash = sha3_256.convert(rghc); + + return hash.hex(); } +@internal bool isValidChecksum(String providedHex, Uint8List rghc) => providedHex == generateChecksum(rghc); diff --git a/lib/src/compression.dart b/lib/src/compression.dart index 9d05803..a09d868 100644 --- a/lib/src/compression.dart +++ b/lib/src/compression.dart @@ -1,9 +1,12 @@ import 'dart:typed_data'; import 'package:lzma/lzma.dart'; +import 'package:meta/meta.dart' show internal; +@internal Uint8List compressGHC(Uint8List rghc) => Uint8List.fromList(lzma.encode(rghc)); +@internal Uint8List decompressGHC(Uint8List compressed) { List decompressed = lzma.decode(compressed); diff --git a/lib/src/conversion.dart b/lib/src/conversion.dart index 4331c44..29c432c 100644 --- a/lib/src/conversion.dart +++ b/lib/src/conversion.dart @@ -2,18 +2,23 @@ import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter/widgets.dart' show Color; +import 'package:meta/meta.dart' show internal; +@internal Map convertColourToInt(Map colourMap) => colourMap.map((key, value) => MapEntry(key, value.value)); +@internal Map convertIntToColour(Map intMap) => intMap.map((key, value) => MapEntry(key, Color(value))); +@internal Uint8List encodedColour(Map colourMap) { List enc = utf8.encode(jsonEncode(convertColourToInt(colourMap))); return enc is Uint8List ? enc : Uint8List.fromList(enc); } +@internal Map decodeColour(Uint8List rawContent) => convertIntToColour(jsonDecode(utf8.decode(rawContent))); diff --git a/lib/src/exception.dart b/lib/src/exception.dart index 6bfc321..1fd7521 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -1,25 +1,18 @@ /// As a Java's `Throwable` roles which uses for implementing [Exception] and /// [Error] in this package. -abstract class GitHubColourThrowable { +abstract interface class GitHubColourThrowable { /// Message display in [GitHubColourThrowable]. /// /// This getter as `dynamic` type that to make compatable in built-in /// [Error] and [Exception] (e.g. [AssertionError]). - get message; - - /// Constructor of [GitHubColourThrowable]. - /// - /// This factory aims to prevent implementing [GitHubColourThrowable] by - /// extending classes. - factory GitHubColourThrowable() { - throw UnimplementedError("Do not extends this throwable."); - } + dynamic get message; } /// An [Error] that can not fetch [GitHubColour] data. abstract class GitHubColourLoadFailedError extends Error implements GitHubColourThrowable { - final message; + @override + final dynamic message; /// Constructor when some issue happended during loading GitHub colour data. GitHubColourLoadFailedError( @@ -27,5 +20,5 @@ abstract class GitHubColourLoadFailedError extends Error "There are some unexpected error when loading resources."]); @override - String toString() => message; + String toString() => "$message"; } diff --git a/lib/src/http/normal.dart b/lib/src/http/normal.dart new file mode 100644 index 0000000..c0ed63e --- /dev/null +++ b/lib/src/http/normal.dart @@ -0,0 +1,5 @@ +import 'package:http/http.dart'; +import 'package:meta/meta.dart'; + +@internal +Client initalizeClient() => Client(); diff --git a/lib/src/http/web.dart b/lib/src/http/web.dart new file mode 100644 index 0000000..edc4191 --- /dev/null +++ b/lib/src/http/web.dart @@ -0,0 +1,6 @@ +import 'package:fetch_client/fetch_client.dart'; +import 'package:http/http.dart' show Client; +import 'package:meta/meta.dart'; + +@internal +Client initalizeClient() => FetchClient(mode: RequestMode.cors); diff --git a/lib/src/swatch.dart b/lib/src/swatch.dart new file mode 100644 index 0000000..f9d1237 --- /dev/null +++ b/lib/src/swatch.dart @@ -0,0 +1,215 @@ +import 'dart:collection'; +import 'dart:convert'; + +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart' + show Color, ColorSwatch, WidgetsFlutterBinding; +import 'package:http/http.dart' + hide delete, head, get, patch, post, put, read, readBytes, runWithClient; + +import 'cache/cache.dart'; +import 'cache/exception.dart'; +import 'exception.dart'; +import 'http/normal.dart' if (dart.library.js_interop) 'http/web.dart'; + +const String _src = + "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json"; + +/// An [Error] thrown when response unsuccessfully and no cache can be used. +final class GitHubColourHTTPLoadFailedError + extends GitHubColourLoadFailedError { + /// HTTP response code when fetching colour data. + final int responseCode; + + GitHubColourHTTPLoadFailedError._(this.responseCode) + : assert(responseCode != 200); + + @override + String toString() => + "GitHubColourLoadFailedError: Can not receive GitHub language colour from server with HTTP code $responseCode."; +} + +/// An [Error] thrown when no resources available to initalize [GitHubColour]. +final class GitHubColourNoAvailableResourceError + extends GitHubColourLoadFailedError { + GitHubColourNoAvailableResourceError._(); + + @override + String toString() => + "GitHubColourNoAvailableResourceError: Unable to read GitHub colour data with all available sources."; +} + +Color _hex2C(String hex, [String alphaHex = "ff"]) { + assert(RegExp(r"^#[0-9a-f]{6}$", caseSensitive: false).hasMatch(hex)); + assert(RegExp(r"^[0-9a-f]{2}$", caseSensitive: false).hasMatch(alphaHex)); + + return Color( + int.parse("$alphaHex${hex.substring(1)}".toUpperCase(), radix: 16)); +} + +Map _colourReader(String json) => + (jsonDecode(json) as Map).map( + (language, node) => MapEntry( + language, _hex2C(node["color"] ?? GitHubColour._defaultColourHex))); + +/// A class for getting GitHub language colour. +/// +/// Since 2.0.0, [GitHubColour] implemented [ColorSwatch] that getting colour +/// can be more convenience. And serval old API will be [Deprecated]. +final class GitHubColour extends UnmodifiableMapBase + implements ColorSwatch { + static GitHubColour? _instance; + final Map _githubLangColour; + + /// A [String] of hex value when the language is undefined or null. + static const String _defaultColourHex = "#f0f0f0"; + + /// [Color] object of [defaultColourHex]. + static Color get _defaultColour => _hex2C(_defaultColourHex); + + GitHubColour._(Map githubLangColour) + : _githubLangColour = Map.unmodifiable(githubLangColour); + + /// Construct an instance of [GitHubColour]. + /// + /// If [offlineLastResort] enabled, it loads package's `colors.json` for + /// getting colour data offline. And it must be called after + /// [WidgetsFlutterBinding.ensureInitialized] invoked in `main()` method to + /// allow get offline colour data from [rootBundle]. + /// + /// When all resources failed, it throws + /// [GitHubColourNoAvailableResourceError]. If [offlineLastResort] disabled, + /// either [GitHubColourHTTPLoadFailedError] (if network available) or + /// [Exception] that repersenting no network state (e.g + /// [SocketException](https://api.dart.dev/stable/dart-io/SocketException-class.html) + /// in `"dart:io"` package). + /// + /// [offlineLastResort] only works when [initialize] invoked first time + /// in entire runtime. This parameter will be ignored once the instance + /// constructed. + /// + /// Since `1.2.0`, it added chechsum validation on the cache. When the cache's + /// checksum does not matched, it throws + /// [GitHubColourCacheChecksumMismatchedError]. + static Future initialize({bool offlineLastResort = true}) async { + if (_instance == null) { + final Uri ghc = Uri.parse(_src); + Map ghjson; + + bool cacheSource = false; + Client c = initalizeClient(); + + try { + var resp = await c.get(ghc); + if (resp.statusCode != 200) { + throw GitHubColourHTTPLoadFailedError._(resp.statusCode); + } + ghjson = _colourReader(resp.body); + } catch (neterr) { + try { + // Second source. + ghjson = await getCache(); + cacheSource = true; + } catch (cerr) { + if (!offlineLastResort) { + // When offline last resort disabled. + throw neterr; + } + + try { + // Use provided JSON file as last resort. + ghjson = _colourReader(await rootBundle.loadString( + "packages/github_colour/colors.json", + cache: false)); + } catch (bundleerr) { + throw GitHubColourNoAvailableResourceError._(); + } + } + } finally { + c.close(); + } + + if (!cacheSource) { + // Do nothing if received data is exact same with source. + await saveCache(ghjson); + } + + _instance = GitHubColour._(ghjson); + } + } + + /// Perform [initialize] and return [GitHubColour]. + /// + /// If no instance created, it will construct and will be reused when + /// [getInstance] or [getExistedInstance] called again. + /// + /// This method is deprecated since it may not required to uses [GitHubColour] + /// once the instance created. + @Deprecated("Please call void function `initialize()`") + static Future getInstance( + {bool offlineLastResort = true}) async { + await initialize(offlineLastResort: offlineLastResort); + + return _instance!; + } + + /// Get constructed instance which called [initialize] early. + /// + /// It throws [UnimplementedError] if called with no existed instance. + static GitHubColour getExistedInstance() { + if (_instance == null) { + throw UnimplementedError("No existed instance found in GitHubColour"); + } + + return _instance!; + } + + /// Resolve [key] as language and find repersented [Color] from providers. + /// + /// If [key] is undefined, it returns default colour instead. + @override + Color operator [](Object? key) => _githubLangColour[key] ?? _defaultColour; + + @override + int get alpha => _defaultColour.red; + + @override + int get blue => _defaultColour.blue; + + @override + double computeLuminance() => _defaultColour.computeLuminance(); + + @override + int get green => _defaultColour.green; + + @override + Iterable get keys => Set.unmodifiable(_githubLangColour.keys); + + @override + double get opacity => _defaultColour.opacity; + + @override + int get red => _defaultColour.red; + + @override + int get value => _defaultColour.value; + + @override + Color withAlpha(int a) => _defaultColour.withAlpha(a); + + @override + Color withBlue(int b) => _defaultColour.withBlue(b); + + @override + Color withGreen(int g) => _defaultColour.withGreen(g); + + @override + Color withOpacity(double opacity) => _defaultColour.withOpacity(opacity); + + @override + Color withRed(int r) => _defaultColour.withRed(r); +} + +/// Alias type for repersenting "colour" in American English which does exactly +/// same with [GitHubColour]. +typedef GitHubColor = GitHubColour; diff --git a/pubspec.yaml b/pubspec.yaml index c9e43c9..be78fba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,22 +1,45 @@ name: github_colour description: Receive ozh's GitHub colour to Flutter's colour implementation with caching and fallback. -version: 2.0.0 -homepage: https://www.rk0cc.xyz +version: 3.2.3 repository: https://github.com/rk0cc/github_colour_flutter +topics: + - color + - colour +screenshots: + - description: 'C++ colour applied' + path: screenshots/6qOSnXq.png + - description: 'Java colour applied' + path: screenshots/6Ho6RyT.png + - description: 'Golang colour applied' + path: screenshots/Ksf3x3o.png + - description: 'Dart colour applied' + path: screenshots/uSiOYUF.png + - description: 'Python colour applied' + path: screenshots/yaTEp1i.png environment: - sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + sdk: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" dependencies: flutter: sdk: flutter - http: ^0.13.4 - meta: ^1.7.0 - path: ^1.8.1 - path_provider: ^2.0.10 + http: ^1.1.0 + meta: ^1.9.1 + path: ^1.8.3 + path_provider: ^2.1.1 lzma: ^1.0.1 - shared_preferences: ^2.0.15 - sha3: ^0.2.0 - hex: ^0.2.0 + sembast: ^3.7.0 + sembast_web: ^2.3.0 + hashlib: ^1.12.0 + fetch_client: ^1.1.2 +dev_dependencies: + flutter_lints: ^4.0.0 +platforms: + android: + ios: + windows: + macos: + linux: + web: flutter: uses-material-design: true assets: diff --git a/screenshots/6Ho6RyT.png b/screenshots/6Ho6RyT.png new file mode 100644 index 0000000..c37e065 --- /dev/null +++ b/screenshots/6Ho6RyT.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b78813a7939aab353e0628e48ffe686f930c19d79d567180a4c4b4eea7ec269 +size 10312 diff --git a/screenshots/6qOSnXq.png b/screenshots/6qOSnXq.png new file mode 100644 index 0000000..4b347eb --- /dev/null +++ b/screenshots/6qOSnXq.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31b0962f5c07109a1e45a6a344fc7f10293e114cc79735de9d4e68097967fdd0 +size 9489 diff --git a/screenshots/Ksf3x3o.png b/screenshots/Ksf3x3o.png new file mode 100644 index 0000000..5693ed6 --- /dev/null +++ b/screenshots/Ksf3x3o.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e26c33267144f224ce4b9f501f8dd15ced5c5502f144cbd3f03eb8579dd8260 +size 8806 diff --git a/screenshots/uSiOYUF.png b/screenshots/uSiOYUF.png new file mode 100644 index 0000000..a5f85d1 --- /dev/null +++ b/screenshots/uSiOYUF.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fb9556c6c88e03a23db75798aaba59cbf0f31e6239d7b4efc8627bdaad779ab +size 9892 diff --git a/screenshots/yaTEp1i.png b/screenshots/yaTEp1i.png new file mode 100644 index 0000000..ecdc165 --- /dev/null +++ b/screenshots/yaTEp1i.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2aa0f6b50d3b18d6e23b86aff6ee3d607d4de6ac8d952a98ee2ac46d70b28827 +size 9965