https://github.com/emilyselwood/resparse
Parse screen and image resolutions.
https://github.com/emilyselwood/resparse
golang golang-library resolution screen-size
Last synced: 12 months ago
JSON representation
Parse screen and image resolutions.
- Host: GitHub
- URL: https://github.com/emilyselwood/resparse
- Owner: emilyselwood
- License: apache-2.0
- Created: 2018-11-19T12:04:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-20T20:16:27.000Z (over 7 years ago)
- Last Synced: 2025-04-05T17:11:08.304Z (about 1 year ago)
- Topics: golang, golang-library, resolution, screen-size
- Language: Go
- Size: 8.79 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ResParse
Simple library to parse screen resolutions or image sizes.
Copes with resolutions like "800x600" and things "UHD" or "1080p"
## Example
```go
import "github.com/wselwood/resparse"
x, y, err := resparse.ParseResolution("HD")
if err != nil {
log.Fatal(err)
}
fmt.Println("x:", x, "y:", y)
```
## Contibuting
I would love to have more screen size names included in this. If you need something please raise an issue so we know what to add.
If you want to have a go at adding some your self you are more than welcome. At the bottom of [resolution.go] there is a map[string]struct{x,y int} that contains the known mappings.
Send through a pull request with extras. Please try and keep it in alphabetical order. It makes it slightly easier to maintain. The names must be in upper case. Test cases are also warmly welcomed.
If you find a bug or don't understand something please raise an issue. If it is not a bug we can still probably improve the docs.
## Thanks
Most of the screen sizes in this project were cribbed from wikipedia.