# Attributing GolfCore course data

Any app or site that shows data from the GolfCore Course Data API or MCP server credits
GolfCore and links the course page the data came from. This file gives the exact markup.
Terms: https://www.golfcore.org/terms/#api-service-schedule

## The rule

- Show the credit wherever the data is shown: on the course screen, the scorecard, or the
  map. One credit per screen is enough.
- Link it to that course's page. Every API and MCP course result carries it as `url`, for
  example `https://www.golfcore.org/courses/pebble-beach/`. When a screen shows many
  courses, link https://www.golfcore.org/courses/ instead.
- Use the wording "Course data by GolfCore", the badge files below, or both. Do not
  recolour, stretch, crop or redraw the badge or the G mark.
- In a native app, open the link in the system browser.

## Text only

HTML, text link:

```html
<a href="{course.url}" target="_blank" rel="noopener">Course data by GolfCore</a>
```

Markdown:

```markdown
[Course data by GolfCore]({course.url})
```

Plain text, where links are impossible (print, a watch face, a PDF):

```text
Course data by GolfCore · golfcore.org
```

## Badge files

All files live under `https://www.golfcore.org/brand/attribution/`. Link them there or copy
them into your app.

| File | Size (px) | Use |
| --- | --- | --- |
| `golfcore-badge-light.svg` | 195 × 32 | Light backgrounds, web |
| `golfcore-badge-dark.svg` | 195 × 32 | Dark backgrounds, web |
| `golfcore-badge-light.png`, `@2x`, `@3x` | 195 × 32, 390 × 64, 585 × 96 | Native apps, email |
| `golfcore-badge-dark.png`, `@2x`, `@3x` | 195 × 32, 390 × 64, 585 × 96 | Native apps, email |
| `golfcore-mark.svg` | 32 × 24 | Map corners and tight toolbars |
| `golfcore-mark.png`, `@2x`, `@3x` | 32 × 24, 64 × 48, 96 × 72 | Map corners in native apps |

- Display the badge at 32 px tall. The minimum is 24 px; scale width with height
  (195 × 32 becomes 146 × 24).
- Display the G mark at 24 px tall, never below 20 px. The mark alone is for maps and
  toolbars; it still links the course page and carries the full wording as its label.
- Keep clear space of 8 px around the badge and 4 px around the mark.
- Pick the light badge on light backgrounds and the dark badge on dark ones.

## Badge snippets

Each snippet takes the course result's `url`.

HTML, badge:

```html
<a href="{course.url}" target="_blank" rel="noopener">
  <img src="https://www.golfcore.org/brand/attribution/golfcore-badge-light.svg"
       width="195" height="32" alt="Course data by GolfCore">
</a>
```

HTML, G mark in a map corner:

```html
<a href="{course.url}" target="_blank" rel="noopener" title="Course data by GolfCore"
   style="position:absolute;right:8px;bottom:8px">
  <img src="https://www.golfcore.org/brand/attribution/golfcore-mark.svg"
       width="32" height="24" alt="Course data by GolfCore">
</a>
```

React:

```jsx
export function GolfCoreAttribution({ course, theme = "light" }) {
  return (
    <a href={course.url} target="_blank" rel="noopener">
      <img
        src={`https://www.golfcore.org/brand/attribution/golfcore-badge-${theme}.svg`}
        width={195}
        height={32}
        alt="Course data by GolfCore"
      />
    </a>
  );
}
```

React Native (React Native's `Image` does not render SVG, so use the @3x PNG):

```jsx
import { Image, Linking, Pressable } from "react-native";

export function GolfCoreAttribution({ course, theme = "light" }) {
  return (
    <Pressable
      onPress={() => Linking.openURL(course.url)}
      accessibilityRole="link"
      accessibilityLabel="Course data by GolfCore"
    >
      <Image
        source={{ uri: `https://www.golfcore.org/brand/attribution/golfcore-badge-${theme}@3x.png` }}
        style={{ width: 195, height: 32 }}
      />
    </Pressable>
  );
}
```

SwiftUI (or add the three PNGs to your asset catalog and use `Image("golfcore-badge-light")`):

```swift
import SwiftUI

struct GolfCoreAttribution: View {
    let courseURL: URL
    var theme = "light"

    var body: some View {
        Link(destination: courseURL) {
            AsyncImage(
                url: URL(string: "https://www.golfcore.org/brand/attribution/golfcore-badge-\(theme)@3x.png"),
                scale: 3
            ) { image in
                image
            } placeholder: {
                Text("Course data by GolfCore")
            }
            .frame(width: 195, height: 32)
        }
        .accessibilityLabel("Course data by GolfCore")
    }
}
```

Jetpack Compose (uses Coil's `AsyncImage`; or put the PNGs in `res/drawable-*dpi` and use `painterResource`):

```kotlin
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage

@Composable
fun GolfCoreAttribution(courseUrl: String, theme: String = "light") {
    val uriHandler = LocalUriHandler.current
    AsyncImage(
        model = "https://www.golfcore.org/brand/attribution/golfcore-badge-$theme@3x.png",
        contentDescription = "Course data by GolfCore",
        modifier = Modifier
            .size(195.dp, 32.dp)
            .clickable { uriHandler.openUri(courseUrl) }
    )
}
```

The attribution page with previews and copy buttons:
https://www.golfcore.org/developers/attribution/
